Password Encoding and Remote Submission - WRDS/SAS Tutorial (1)

Jul 22, 2019

Most junior research students did not have any experience with data manipulation and analysis with SAS and the Wharton Research Data Services (WRDS), which motivates me about this tutorial series.

I am a strong supporter for open data and I firmly believe that researchers should publish the dataset and source code they used to get their results. This is because reproducibility is just critical in any scientific study. As such, I tend to make sure that every program I write is well-documented and self-executable, especially those using data from WRDS.

To achieve this goal, I prefer to have my SAS program run directly on WRDS by remote submission. WRDS has an instruction on accessing WRDS data from SAS on our own PCs. However, if you want to save the effort of entering username and password every time, you’ll need to encode your password. Concluding the two articles, basically you just need to follow the steps below.

Simple Steps

First, open your SAS program locally on your PC, and run the following command and replace 1234567890 with your WRDS password:

proc pwencode in="1234567890";run;

The output {SAS002}23AA9C2811439227077603C8365060A44800CA1F is the encoded password (which is 1234567890 in this example).

Next, put the following statements at the beginning of your SAS program and replace my_username with your WRDS username:

%let wrds=wrds-cloud.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=my_username password="{SAS002}23AA9C2811439227077603C8365060A44800CA1F";

After these statements, you’ll be able to submit your SAS program remotely to and execute on the WRDS server by enclosing your statements with rsubmit and endrsubmit. An example would be:

rsubmit;
proc download data=comp.funda out=funda; run;
endrsubmit;

As you can guess, this statement actually downloads the whole Compustat Fundamentals Annual to the local work directory, with the downloaded dataset also named funda.

Lastly, after everything, you should run signoff to close the connection with WRDS.

Full code is as below.

%let wrds=wrds-cloud.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=my_username password="{SAS002}23AA9C2811439227077603C8365060A44800CA1F";

rsubmit;
proc download data=comp.funda out=funda; run;
endrsubmit;
signoff;

Replace my_username and the encoded password with your actual WRDS username and encoded password, paste it in the SAS program editor and press F3. You’ll be downloading comp.funda in a few seconds!

Video Instruction

I made a short video introduction as well, available on my YouTube channel.

comments powered by Disqus