LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 24 Dec 2008 08:51:03 -0800
Reply-To:     "AbbeyFN@aol.com" <AbbeyFN@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "AbbeyFN@aol.com" <AbbeyFN@AOL.COM>
Organization: http://groups.google.com
Subject:      CRSP non-trading days and use of @CRSP informants
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Greetings,

I am new to the group and I have already found quite a few posts useful. I would like to give a personal thanks to everyone here!

My issue: I am analyzing transactional data and using CRSP for the daily returns. The code below links my data with CRSP, extracts the daily returns for 5 calendar days prior to my transaction day, and then sums those returns.

My code currently works, but with CRSP (and the code I am using below) it provides me with the previous 5 calendar days. I need trading days (or days where there is return data available). For example, if a trade is executed on Monday, and I need the past 5 trading days, my code will give me the returns for Wed, Thurs, and Fri from the previous week because my code takes into consideration Sat and Sun (when there is no data) and I need the return data from Mon-Fri (provided there is return data for all of those days).

I attempted to use the @CRSP informats (found in the SASECRSP Interface Engine manual p. 84). Specifically, the manual states I can use @CRSPDBD (daily) to get backward returns but the manual doesn't provide an example and I am lost on how to use this informant. I have attempted other ways but with no success.

Any help would be appreciated. My code is posted below.

Boris Abbey PhD Candidate Old Dominion University Norfolk, VA

/* Start: Code Part One This program extracts data from CRSP and gives the 5 previous days returns (t-5) which will be used for a study that looks at whether individual traders enter short sales after the stock has increased in price. Data comes from (1) transactional data and (2) CRSP daily. */

LIBNAME mstk sasecrsp "%sysget(CRSP_DSTK)" /*I must have this here before using the CRSP date format below*/ SETID=10; data t1 (keep=ticker date1); set C2.trades; format date1 yymmdd10.; /*This converts Excel date format into SAS*/ /*format date1 crspdcsd8.; /*This converts SAS to CRSP format*/ run; data t (keep = ticker date ldate); set work.t1; /* Call the SAS date to Integer function*/ date = crspds2i(date1); /*The code below is for lagged returns five days prior to the transaction*/ ldate=date-5; proc print; run;

LIBNAME mstk sasecrsp "%sysget(CRSP_DSTK)" SETID=10 INSET='t,TICKER,TICKER,ldate,date'; data a; set mstk.ret; proc print; run;

/*End: Code Part One*/

/* Start: Code Part Two*/ /* This provides the sum of the returns for each permno*/ proc summary data2 = a nway missing; class permno; var ret; output out = need1 sum=; run;

proc print data2 = need1 noobs; run;

/*End: Code Part Two*/


Back to: Top of message | Previous page | Main SAS-L page