This is an introduction I give to PhD students at LSE. If you would like to use Stata, please see this manual by the legendary Aditi Payasi:


Why use SAS and not the WRDS online interface?

Because you can change the data on the WRDS server before you download the output, which can be especially useful for very big data sets.


Step 1: Set up

Get a WRDS account. Link on the website.

Get IT to install: SSH Secure Shell (or putty, or MobaXterm), a File Transfer program (I like FileZilla which is free), and StatTransfer.

SAS is on all LSE desktops. You can get a private license for your laptop from the library IT desk. They’ll also give you CDs to install it but I ended up trying for days and giving it to IT Support 2 (Kuldip) to install it. Kuldip is also the mastermind who knows anything about SAS in the IT Support. (QMUL students: ask Donald for installation.)


Step 2: Write Code

Our home address is /scratch/lse (or /scratch/qmul). You can create folders within that you can refer to as your home library in your code. The content of your folder will disappear after a while: copy and paste it back if you would like to keep it.

There is also a personal folder that only you can access but that’s smaller.

Useful to know: data set list on WRDS with variable names and addresses for their data:

WRDS also has example codes that you can start off with.

CRSP and Compustat: LSE only subscribes to “Annual update”. Don’t refer to the monthly/quarterly update addresses.


Step 3: Upload code

(and other data files in SAS if using) to WRDS, using your file transfer program. Host: s, Port 22

On your file transfer program you can also create a folder so that your files are not mixed with everyone else’s from LSE.

Alternatively, you may want to use the cloud interface itself. See the Stata manual on how to do that.


Step 4: Run code

Use SSH secure shell

connect to and log in


sas -nodms

cd scratch/lse, enter (or your folder)

(if you prefer to define your folder: “libname moqi “/scratch/qmul/Moqi”  inencoding=asciiany;” the latter ensures that the SAS data from your computer and the cloud are compatible)


(or actual lines of code)


Step 5: Check log

SAS creates a log in the folder of your SAS code. Download it to check your progress. I prefer to open it in word because the format is messed up in my text editor.

In general, if your files are locked, the code is still running.

If you send another code for execution it will only start after the current one stopped (or you kill it).


Step 6: Download the data


Step 7: Use stattransfer to transfer data to Stata (if using)


Step 8: Enter what you did in your data diary. You can use any format you like but include the following items

  • Objective
  • Code changed (historic name, new name with path)
  • Changes made. If possible copy the pieces of code
  • Errors that you found in the process and corrected
  • Errors found or other points to be checked later
  • Data created (name and path)
  • Things left to do

You should do that in general, not only when using SAS. For more professional advice on version control see