Posted on

How to connect to the WRDS cloud server and download the Compustat Fundamental library

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:

  1. The first line specifies the WRDS server address and port number.
  2. The second line sets the communication method to TCP and the remote access method to WRDS.
  3. 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.
  4. The rsubmit statement is used to submit code for execution on the WRDS server.
  5. 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.
  6. The options obs=max statement is used to set the maximum number of observations that can be downloaded.
  7. 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”.
  8. The run statement is used to execute the download process.
  9. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *