This SAS code connects to the WRDS (Wharton Research Data Services) cloud server and downloads the Compustat Fundamental library.
/*remote connection to wrds*/
%let wrds = wrds-cloud.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=soleiman password="Slafh0oai29";
rsubmit;
libname comp "/wrds/comp/sasdata/d_na";
options obs=max;
proc download data=comp.funda out=funda; run;
endrsubmit;
Here is a step by step explanation of the code:
- The first line specifies the WRDS server address and port number.
- The second line sets the communication method to TCP and the remote access method to WRDS.
- The third line is used to log in to the WRDS server using a username and password. Replace the “XXX” with your actual WRDS username and password.
- The
rsubmit
statement is used to submit code for execution on the WRDS server. - The
libname
statement is used to assign a name to the library on the WRDS server that we want to access. In this case, the library is named “comp” and it is located in the “/wrds/comp/sasdata/d_na” directory. - The
options obs=max
statement is used to set the maximum number of observations that can be downloaded. - The
proc download
statement is used to download the data from the WRDS server. In this case, the data is coming from the “comp.funda” dataset in the “comp” library and is being downloaded to a local SAS dataset named “funda”. - The
run
statement is used to execute the download process. - The
endrsubmit
statement is used to end the execution of code on the WRDS server.
Once you run this code, you will have the Compustat Fundamental library downloaded to your local SAS environment, and you can start using the data for your analysis. Note: You will need to have a valid WRDS account and be authorized to access the Compustat Fundamental library.