5 of 7
5
SEC Filings on EDGAR SAS File
Posted: 28 August 2014 05:01 AM   [ Ignore ]   [ # 61 ]
Newbie
Rank
Total Posts:  3
Joined  2014-08-28

Hi,
I have the similar problem. The error exists in line 28, that is,

open dlthis"c_10K_list.txt" or die $!; 
No such file or directory at download.pl line 28 

I don’t understand how to solve it, even I have scanned all your reply. Can you give an exact answer?

Thanks a lot.

smilebey - 29 December 2012 06:57 AM

Hi,

first of all thank you Joost for the great help in extracting SEC filings so far. I got to the point where I run the Perl code from http://www.wrds.us/index.php/tutorial/view/26

However, executing the code gives me following error message:

No such file or directory at download.pl line 45, <dlthisline 227324 

I was trying to understand the message but couldnt find any explanation. As far as I understand the problem is somewhere here:

$filename $write_dir "/" $CIK ".txt"

Probably it’s sth easy to see but I am struggling with this already all day long. Could anyone lead me to the right path? TIA

smilebey

PS: great forum that I found here!!!
PSS: Wish you all a happy new year smile

Profile
 
 
Posted: 28 August 2014 05:13 AM   [ Ignore ]   [ # 62 ]
Newbie
Rank
Total Posts:  3
Joined  2014-08-28

Hi,
I have the similar problem. The error exists in line 28, that is,

open dlthis, “c_10K_list.txt” or die $!;
No such file or directory at download.pl line 28
I don’t understand how to solve it, even I have scanned all your reply. Can you give an exact answer?

Thanks a lot.

Joost Impink - 29 December 2012 02:08 PM

hi Smilebey,

I am sorry to hear about your struggles in the holiday smile

I have attached a very similar version to this post (rename .txt to .pl before running).

Hope this one will work for you,

best regards,

Joost

Profile
 
 
Posted: 28 August 2014 06:57 AM   [ Ignore ]   [ # 63 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi buaalouis,

‘No such file’-error means somehow perl can’t find the file.

Things that can cause this:
- Windows may ‘hide’ the file extension of known file types, so, the file may be called ‘c_10K_list.txt.txt’ even though it looks like ‘c_10K_list.txt’
- slashes need double escaping in double quotes, so you “C:\\myfolder\\subfolder” instead of “C:\myfolder\subfolder”
- perl may be executed from another directory, and is looking in the wrong place for the input file (solve this by using absolute path, starting with a drive letter)

Hope this helps,

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 August 2014 01:56 AM   [ Ignore ]   [ # 64 ]
Newbie
Rank
Total Posts:  3
Joined  2014-08-28

Thanks for your reply.

I have hit upon a way to execute my code, just double click the file “download.pl” and then it can download the SEC filings automatically, but I can not execute it in Perl(command line). I am a newbie so I am confused with this.

Joost Impink - 28 August 2014 06:57 AM

hi buaalouis,

‘No such file’-error means somehow perl can’t find the file.

Things that can cause this:
- Windows may ‘hide’ the file extension of known file types, so, the file may be called ‘c_10K_list.txt.txt’ even though it looks like ‘c_10K_list.txt’
- slashes need double escaping in double quotes, so you “C:\\myfolder\\subfolder” instead of “C:\myfolder\subfolder”
- perl may be executed from another directory, and is looking in the wrong place for the input file (solve this by using absolute path, starting with a drive letter)

Hope this helps,

Joost

Profile
 
 
Posted: 29 August 2014 06:53 AM   [ Ignore ]   [ # 65 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi,

Click ‘start’ button, in the search box right above it, type ‘cmd’. It will search and show a black icon with ‘C:\’ in it. Select that program ‘cmd.exe’. It will open the command line program.

Navigate to the directory with your perl program, with cd “C:\yourdir\yoursubdir”. To execute a perl program, type: perl download.pl.

Perl (as a language) is quite old, and there is a lot of resources online to get you going. (But that takes some investment in time)

Hope this helps,

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: 24 October 2014 11:14 AM   [ Ignore ]   [ # 66 ]
Newbie
Rank
Total Posts:  3
Joined  2014-10-24

Hi Joost,

I am new to both SAS and Perl and need to download and screen SEC filings for my research. Thanks to your great replies, I managed to download all the files I need! Thanks a lot!
I am now trying to change the names of the downloaded files, as I’m having problems importing the files with name 1, 2, 3, etc. into SAS for the analysis. (SAS keeps giving me an error message that the variable name isn’t valid.)

I was trying to use the code you posted a while ago by replacing the previous $filename definition by the combination of $lastSlash, $longname, and $filename as you suggested. However, it didn’t work.
I also tried a simpler version where I used the variable $get_file instead of $CIK to name the file. But again, it didn’t work. I was also trying to go through the log document to figure out where the error is but the log file is empty and I just couldn’t figure out why and how to change it.

Do you have an idea what I might be doing wrong? As I said, I’m new to both programs and apologize in case my questions are stupid.

Thanks,
pitu_lee

Joost Impink - 13 January 2014 08:20 PM

hi Mark,

I just realized that this code

$lastSlash rindex ($get_file'/');
$longname substr $get_file $lastSlash;
$filename $write_dir "/" $longname

probably needs a plus 1, like this:

$lastSlash rindex ($get_file'/') + 1;
$longname substr $get_file $lastSlash;
$filename $write_dir "/" $longname

$lastSlash gives the position of the last ‘/’, and you want to get the filename, which is 1 position later.

In general, scanning a few files and printing things to the screen would help find bugs. For example, printing $filename to the screen would help to see if that variable makes sense or not. The ‘extra’ ‘/’ would then probably show up, etc.

best regards,

Joost

 

Profile
 
 
Posted: 24 October 2014 11:23 AM   [ Ignore ]   [ # 67 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi pitu_lee,

If I understand correctly, you want to do the text analyses in SAS?

It probably makes most sense to look at the importing of the file in SAS. If that import works, there would be no need to rename files and such.

Can you post your SAS code (that fires the error that the variable name isn’t valid)?

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: 24 October 2014 01:27 PM   [ Ignore ]   [ # 68 ]
Newbie
Rank
Total Posts:  3
Joined  2014-10-24

Hi Joost,

Thanks for getting back to me this quickly. I have been using the following codes:

proc import datafile 'H:\research\data\annual reports edgar SAS\download trial\1.txt'
;

proc print data 1;
run

I renamed one file manually and imported it to make sure the code itself is correct and it works fine. SAS gives me the following error messages when using the file name 1 and ‘1’ respectively:

  proc print data = 1;
             
ERROR 22-322: Expecting a name.
ERROR 200-322: The symbol is not recognized and will be ignored

proc print data = ‘1’;

ERROR: The value 1 is not a valid SAS name.


Thanks,
pitu_lee

 

Profile
 
 
Posted: 24 October 2014 01:46 PM   [ Ignore ]   [ # 69 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Pitu_lee,

How about ‘renaming’ the imported file with the ‘out=’ mechanism in proc import? (See http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000308090.htm)

proc import datafile 'H:\research\data\annual reports edgar SAS\download trial\1.txt' out data1

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: 24 October 2014 02:02 PM   [ Ignore ]   [ # 70 ]
Newbie
Rank
Total Posts:  3
Joined  2014-10-24

Hi Joost,

The renaming worked perfectly. Thanks a lot for suggesting it.

Best,
Pitu_lee

Profile
 
 
Posted: 24 October 2014 02:10 PM   [ Ignore ]   [ # 71 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

ok, good! glad it works! smile

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: 05 November 2014 05:01 PM   [ Ignore ]   [ # 72 ]
Newbie
Rank
Total Posts:  9
Joined  2014-01-11

Hi Joost,

I’m back at this again, and I forget where to start. I have the SAS index file (table that lists all the filings) and now I need to create the text file with the list of 10-Ks I want to download (using PERL in the final step). Perhaps this is the most basic question you’ve received, but how do I specify in the SAS download code what 10-Ks I want downloaded from the index file/table (edgar.filings)? Is the download file written to just list all 10-ks or do I have to specify my list by manually inserting the 10-k identifiers in the SAS code?

Thank you again for the help. This forum, and the effort you put into maintaining it and helping the public, is tremendous!

Mark

Profile
 
 
Posted: 05 November 2014 06:35 PM   [ Ignore ]   [ # 73 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Mark,

I’m glad you find it helpful!

The ‘edgar.filings’ is a dataset that holds the url (link to actual filing), date, cik, etc for all filings (not just 10-Ks). So, if you want to scan 10-Ks only, you need to decide for which firms (cik) and which time period (filter on date) you want the 10-K for.

Once you have filtered out the filings of interest, you export the urls to a csv for downloading and scanning etc in Perl.

Does that help? (I’m not 100% I understand your question).

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: 05 November 2014 07:04 PM   [ Ignore ]   [ # 74 ]
Newbie
Rank
Total Posts:  9
Joined  2014-01-11

Hello again,

Thanks for your prompt response!

Sorry for my lack of clarity, but yes, you’re along the right lines. So (assuming I just want to scan the 10-ks) I’ll copy and paste the lines from the edgar.filings table for the firms and time period I want into a CSV file? [and then use PERL to pull the 10-ks]

Is it a different process if I want to actually download each 10-k onto my computer? I think I did this in the past for about 4000 10-ks over a 3 or 4 year period. However, I can’t quite figure out how I retrieved the information from the edgar.filings table for those 4000 10-ks… I guess I’m really just trying to figure out whether this step (of building the CSV file) is done manually using the edgar.filings table, by copy and pasting the firm and date information…

Thanks again Joost (I think my lack of clarity is the result of have a very basic question that I can’t seem to figure out the answer to).

Mark

Profile
 
 
Posted: 05 November 2014 07:37 PM   [ Ignore ]   [ # 75 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Mark,

Ok—did you see this post? http://www.wrds.us/index.php/tutorial/view/26

Selecting the 10-Ks manually is not appealing. I suppose the ‘main scenarios’ is that you either have a dataset (from Compustat/CRSP, etc), for which you want the 10-Ks scanned. In that case you merge the dataset with edgar.filings. The other scenario is that you can filter on edgar.filings without another ‘beginning’ dataset (as in the link above /view/26).

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
 
 
   
5 of 7
5