How can I get crsp_m
Posted: 05 August 2014 04:48 AM   [ Ignore ]
Total Posts:  26
Joined  2014-05-03

Hi joost,
  I extract a piece of sas code from WRDS, as follows.

%let begdate = 01MAR1980;
%let enddate = 31DEC2010;
/* Create a CRSP Subsample with Monthly Stock and Event Variables */
/* Restriction on the type of shares (common stocks only)      */
%let sfilter = (shrcd in (10,11));
/* Selected variables from the CRSP monthly data file (crsp.msf)  */
%let msfvars = prc ret shrout cfacpr cfacshr;
/* Selected variables from the CRSP monthly event file (crsp.mse) */
%let msevars = ncusip exchcd shrcd ;
/* This procedure creates a Monthly CRSP dataset named “CRSP_M”  */

  When I run this piece of code, there is an error in SAS which says “ERROR 180-322: Statement is not valid or it is used out of proper order”.
  The error occurs at the last procedure, which creates the CRSP_M.
  Is there anything wrong when I generate CRSP_M?


Posted: 06 August 2014 06:06 PM   [ Ignore ]   [ # 1 ]
Total Posts:  901
Joined  2011-09-19

hi Xinjiao,

These are macro function calls, so you need macro debugging facilities to find out what is going on.

See this article here for pointing out the main mechanisms:

I would suggest to use MPRINT with MFILE; this will write the code that SAS runs into a text file. You can then inspect this textfile and run it. It should generate the same error, and then you will know which line ‘triggers’ the error.

Hope this helps,



To reply/post new questions: Please use the group WRDS/SAS on Google Groups!

‹‹ calculate excess returns      Delisted firms ››