Downloading Compustat items using remote connection to WRDS

Reply
New Contributor
Posts: 2

Downloading Compustat items using remote connection to WRDS

Hi all, 

 

I'm replicating the work of a paper published in the AER (link here: https://www.aeaweb.org/articles?id=10.1257/aer.96.3.796)

 

It seems like the authors use SAS to download data from WRDS/Compustat. I'm trying to do something similar but my problem is that I can't refer to the data items in compustat. I had to manually download a small sub-sample of the dataset and figure out the naming. It seems that refering to variable names using Dataxxx is standard in compustat. 

 

libname dat '/crds/compustat/sasdata'; 

*this is a dataset downloaded from WRDS and the authors are referencing to the library; 

data a;

set dat.fcab2;

fileid=1;

array data data1-data350;

do over data;

if abs(data-.0001) le .00001

then data=.;

else if abs(data-.0008) le .00001

then data=0;

end;



year=year(date);

year=year-1900;



keep cnum cic dnum year fyr fileid smbl

data1 data2

data147 data148 


aftnt1 aftnt13 aftnt15 aftnt22 aftnt25 aftnt28 aftnt29 

aftnt32 aftnt33 aftnt34 aftnt35 aftnt37 aftnt39 aftnt50

cpspin csspii csspin data308 finc xrel naics spdrc;

 The code that I'm working on is attached. It should be an easy question for someone who already uses this method to access Compustat data. 

 

Thank you very much!! 

Attachment
PROC Star
Posts: 1,672

Re: Downloading Compustat items using remote connection to WRDS

Sorry, your problem isn't clear.

Do you have the data?

There is no sas data set that could see on the  provided link, in which case your libname below will not work.

The line 

year=year-1900;

hints of ancient code prone to the Y2K bug.

The attached file points to a sas/connect spawner. Can you connect to it?

Please provide more details.

 

New Contributor
Posts: 2

Re: Downloading Compustat items using remote connection to WRDS

Thank you for the reply. 

 

I do not have the data. But I have access to the WRDS (https://wrds-web.wharton.upenn.edu/wrds/index.cfm?) which allows you to create a remote session using SAS. The code is ancient indeed. 

 

I'm really trying to replicate the code to pull the required data from WRDS. 

 

What do you mean SAS/connect spawner? I'm not sure if it is similar to the connection that I've described. 

 

Any further hints would be greatly appreciated! 

 

 

PROC Star
Posts: 1,672

Re: Downloading Compustat items using remote connection to WRDS

> I'm not sure if it is similar to the connection that I've described. 

It is.

 

The code that pulls the data is this:

 

%********************* Connect to server *************;

%let wrds=wrds.wharton.upenn.edu 4016;
options comamid=tcp;
signon wrds username=_prompt_;
 

%********************* Bing back the data *************;

libname NAM "/wrds/comp/sasdata/nam" server=wrds;
data A;  
  set NAM.FUNDA;  
run;

 

Does this work?

Ask a Question
Discussion stats
  • 3 replies
  • 124 views
  • 0 likes
  • 2 in conversation