SAS

Pad Character Variables with Leading Zeros - SAS Tutorial (3)

Feb 29, 2020
WRDS/SAS Tutorial
WRDS, SAS, STATA

Working with WRDS data, sometimes we’ll want to add leading zeroes to certain variables, for example, CIK. CIK (Central Index Key) is a 10-digit number used by SEC as an entity identifier. Say there is a CIK field in a dataset. If it is stored as a numeric variable, then most software will ignore leading zeroes. As a result, the imported dataset may look like: cik file_type date 1000229 8-K 2011-09-30 100591 8-K 2006-05-11 100826 8-K 2009-06-30 93542 8-K 2007-01-25 To convert the numerically stored CIK to 10-digit character variable, we need to pad it with leading zeros. ...

Use WRDS Macros - WRDS/SAS Tutorial (2)

Nov 14, 2019
WRDS/SAS Tutorial
WRDS, SAS

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. This post explains how to use those handy macros on WRDS when you use remote submission, following the previous one on how to encode your WRDS password and use remote submission to run your code on the WRDS cloud. ...

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

Jul 22, 2019
WRDS/SAS Tutorial
WRDS, SAS

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. ...

Computing Jackknifed Coefficient Estimates in SAS

May 20, 2019
WRDS/SAS Tutorial
SAS, Jackknifed Coefficient, Discretionary Accruals

Background In certain scenarios, we want to estimate a model’s parameters on the sample for each observation with itself excluded. This can be achieved by estimating the model repeatedly on the leave-one-out samples but is very inefficient. If we estimate the model on the full sample, however, the coefficient estimates will certainly be biased. Thankfully, we have the Jackknife method to correct for the bias, which produces the (Jackknifed) coefficient estimates for each observation. ...

Secret Macros to Use in WRDS Cloud

Jan 27, 2019
WRDS/SAS Tutorial
WRDS, SAS

When a SAS program is submitted to WRDS Cloud for remote execution, a small script named autoexec.sas runs before everything. The content of this small script is as below: 1 2 3 4 5 * The library name definitions below are used by SAS; * Assign default libref for WRDS (Wharton Research Data Services); %include '/wrds/lib/utility/wrdslib.sas' ; options sasautos=('/wrds/wrdsmacros/', SASAUTOS) MAUTOSOURCE; What it does is basically making the libnames available, so that when we want to, for example, access the Compustat funda dataset, we just need to write: ...