2 of 7
2
SEC Filings on EDGAR SAS File
Posted: 29 December 2012 02:15 PM   [ Ignore ]   [ # 16 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Smilebey,

If the version in my previous post does not work, can you tell me what is on line 45? (The line that generates the error).

You can use a text editor to find the exact line. Possibly the error is in this statement: open dlthis, “c_10K_list.txt” or die $!;

The file with the list needs to exist (so change the code if different file name).

best regards,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 29 December 2012 03:14 PM   [ Ignore ]   [ # 17 ]
Newbie
Rank
Total Posts:  6
Joined  2012-12-29

Hey Joost,

many thanks for your help. I took over your code and adjusted to my filenames and location of the directories. Now the same error appears (obviously at a different line). Now it is at line 34

No such file or directory at batchdownload.pl line 34, <bestandline 227324. 

As you suggested he struggles with

open OUT">$filenameor die $!; 

227324 is in this case the number of lines in the list of donwload links, which means he already finds the file of links. But I really dont get what he wants from me now.

Any suggestion why it whinges? I uploaded your code adjusted for my files and directories.


Best regards

smilebey

File Attachments
batchdownload2.txt  (File Size: 2KB - Downloads: 371)
Profile
 
 
Posted: 29 December 2012 03:37 PM   [ Ignore ]   [ # 18 ]
Newbie
Rank
Total Posts:  6
Joined  2012-12-29

I commented line 34 and now it is going through the lines of the list but of course without saving the data to disk. So he is not able execute open out command.
Open OUT doesnt work but Open LOG does.  I am not that experienced in PERL, but does it have sth to do with system settings or with the package?

EDIT: Solved it partially:
I changed line 33 into

$filename $CIK ".txt"

which means that it saves the files on the current location and that the path string was not correct. But I still dont get it why.

Profile
 
 
Posted: 29 December 2012 07:04 PM   [ Ignore ]   [ # 19 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Smilebey,

In the code, the output directory is assigned as follows: $write_dir = “C:\\temp”;

How does this look like for you? Does the directory exist, and did you use double slashes?

best regards,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 29 December 2012 07:12 PM   [ Ignore ]   [ # 20 ]
Newbie
Rank
Total Posts:  6
Joined  2012-12-29

For some reason I thought the command will automatically create the folder red face
Sorry for taking your time bc of this stupidity. Thank you very much, not just for this question, but rather for the effort related to the whole SEC extracting topics and replies you contributed. I appreciate it very much.

Best Regards
smilebey

Profile
 
 
Posted: 29 December 2012 07:26 PM   [ Ignore ]   [ # 21 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Smilebey,

You’re welcome - I’m glad it worked out. smile

By the way, I will be adding 2011 and 2012 filings to the SAS dataset when the SEC has made the Q4 archive for 2012 available.

Happy coding smile

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 29 January 2013 12:00 PM   [ Ignore ]   [ # 22 ]
Newbie
Rank
Total Posts:  6
Joined  2012-12-29

Hey Joost,

Again, great thanks for your help with downloading and searching through the SEC filings. So far I got quite far with my project and it looks quite promising. But I had a problem with the data sample during the merging of CIKs and permnos. Nevertheless, I continued with the analysis but now I want to go back to do it properly.

I saw you posted something about that in the wrds official forum but I am still not sure how to do it properly. Following problem: When I was merging the SEC filings with CCM annual fundamentals I used the CIK number (which is, I assume, not historical). Now I want to fix this.  Can I use the following table to do it properly: http://wrds-web.wharton.upenn.edu/wrds/tools/variable.cfm?library_id=137&file_id=66983 and then use gvkey to merge it with the CRSP data? Would be great to be sure that my sample is complete (as much as possibel). Thanks in advance.

smilebey

PS: I dont have access to the linking table of the SEC Analytics Suite (proposed by Rabih Moussawi)

Profile
 
 
Posted: 30 January 2013 12:59 PM   [ Ignore ]   [ # 23 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

merhaba Smilebey,

The historic CIK matching stuff is indeed problematic. But, the table you suggest looks promising (indeed match on gvkey and year to get the CIK of that year). I would just give it a shot and see if it actually works. For example, you could count the number of distinct HCIK grouped by gvkey. Or, manually look up some firms of which you know have changed their CIK. (Or look at observations that you couldn’t match on current CIK).

I did take a look at the SEC Analytics Suite’s matching tables. It looks like they but a lot of effort using multiple sources to reconstruct a linkfile. Since this is sold separately I would suspect that the table you found will not work smile - but, it is definitely worth a shot.

Another way that came to my mind is that Audit Analytics has a url in their tables that links to the original 10K. Using the SEC’s index files it should be possible to link back to the historic CIK of that filing.

If you could post your findings here, that would be helpful.

thanks,

Joost

 

 

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 01 February 2013 05:42 AM   [ Ignore ]   [ # 24 ]
Newbie
Rank
Total Posts:  6
Joined  2012-12-29

Merhaba Joost,

I will post my insides as soon as I finish my analysis. Thanks for your thoughts smile

Smilebey

Profile
 
 
Posted: 01 February 2013 11:47 AM   [ Ignore ]   [ # 25 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

ok, thanks!

good luck! smile

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 17 March 2013 03:24 PM   [ Ignore ]   [ # 26 ]
Newbie
Rank
Total Posts:  16
Joined  2013-03-17

Hello Smileys and Joost,

I am totally new to SAS and perl. Can I ask two questions?  Now I am trying to extract some data from corporate’s 10-K file. I have downloaded the dataset following the instructions in http://www.wrds.us/index.php/repository/view/25; Now I am in the position to run the perl script in SAS. The perl code provided here http://www.wrds.us/index.php/tutorial/view/26 seems to download the txt file into the disk. I am very confused about this, how can I use this perl script to get the data I want ?( I want the firms accelerated status and public float data and they are all on the page 1 of 10-K form). Moreover, do I just need to write ” perl download.pl” in the command line in SAS to run this script ? I tried, but this did not work…I am also very confused about how to run the perl script in SAS?

Would you please help me with these two questions? Maybe these questions quite simple and stupid, however, I cannot figure them out and I have struggled for a day….

Thank you very very much !!!

Profile
 
 
Posted: 17 March 2013 04:54 PM   [ Ignore ]   [ # 27 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi student smile

Struggling with this is very normal! smile

The best way is to use two scripts:
- one script to download the 10K to your harddrive (the one you refer to)
- another script to scan the 10Ks (on your harddrive)

The reason why this is better is that it is likely that you will change your mind with respect to the scanning. (developing, finetuning, sensitivity tests). This way, you only download the data once.

Note: SAS isn’t used when you run perl code. Perl is a different programming language. You will need a perl interpreter to execute perl files. For Windows, I use ‘activeperl’ (http://www.activestate.com/activeperl)

Once that is installed (properly), you can indeed execute perl files from the command line as you say: perl download.pl

Make sure the directory where the files are written indeed exists.

Good luck on you perl adventure smile

Joost

 

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 17 March 2013 07:52 PM   [ Ignore ]   [ # 28 ]
Newbie
Rank
Total Posts:  16
Joined  2013-03-17

Thank you very much for your help,Joost! I will try to find another perl code to scan the file and run the perl codes in this way. Hope I can figure them out! Thanks again!!!

Profile
 
 
Posted: 18 March 2013 01:31 PM   [ Ignore ]   [ # 29 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

ok, good luck!

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 19 March 2013 08:11 PM   [ Ignore ]   [ # 30 ]
Newbie
Rank
Total Posts:  16
Joined  2013-03-17

Hello Joost,

I have struggled with the Perl stuff for two days….Though learned something, I still do not have a clear idea about how to extract data from the 10-K file….Can you tell me is there any package in perl that people use to extract data from 10-K file in finance research? OR I have to write my own code….

Thank you very very much for your help! Still very confused about how people get data in the paper, among the papers I read authors mention little about how to get the data from the 10-K file, they only mention something like ” we collect XX data from their annual 10-K file”..seems very easy to do…

Thanks again,

Best,

stupidstudent

Profile
 
 
   
2 of 7
2