How can I get crsp_m
Posted: 05 August 2014 04:48 AM   [ Ignore ]
Newbie
Rank
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”  */
%crspmerge(s=m,start=&begdate;,end=&enddate;,sfvars=&msfvars;,sevars=&msevars;,filters=&sfilter;);

  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?

  Thanks.
Xinjiao

Profile
 
 
Posted: 06 August 2014 06:06 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
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: http://support.sas.com/resources/papers/proceedings10/147-2010.pdf

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,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
   
 
 
‹‹ calculate excess returns      Delisted firms ››