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>
Subject: CRSP non-trading days and use of @CRSP informants
Content-Type: text/plain; charset=ISO-8859-1
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.
Old Dominion University
/* 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*/
data t1 (keep=ticker date1);
format date1 yymmdd10.; /*This converts Excel date format into
/*format date1 crspdcsd8.; /*This converts SAS to CRSP format*/
data t (keep = ticker date ldate);
/* Call the SAS date to Integer function*/
date = crspds2i(date1);
/*The code below is for lagged returns five days prior to the
LIBNAME mstk sasecrsp "%sysget(CRSP_DSTK)"
/*End: Code Part One*/
/* Start: Code Part Two*/
/* This provides the sum of the returns for each permno*/
proc summary data2 = a nway missing;
output out = need1 sum=;
proc print data2 = need1 noobs;
/*End: Code Part Two*/