BookmarkSubscribeRSS Feed
abdulla
Pyrite | Level 9

Hi, I am using the following to download crsp/Compustat data. I want to download daily stock data not monthly. So, I have to change msf to  dsf. Am I right? And I need data from 2000 to 2015.  I don't need all the historical data. How will I customize the date? I also need the outstanding share to collect. Please help. 

 

proc sql;
create table CCM_LINK as
select distinct a.permno, gvkey, liid as iid,
date, prc, vol, ret
from
crsp.msf as a, /*CRSP Monthly stock file*/
crsp.msenames
(
where=(shrcd in (10 11)) /*Common stocks of U.S. Companies*/
) as b,
ccm.Ccmxpf_linktable
(
where=(
linktype in ('LU' 'LC') /*KEEP reliable LINKS only*/
and LINKPRIM in ('P' 'C') /*KEEP primary Links*/
and USEDFLAG=1 ) /*Legacy condition, no longer necessary*/
) as c
where a.permno=b.permno=c.lpermno /*Linking by permno*/
and NAMEDT<=a.date<=NAMEENDT /*CRSP Date range conditions*/
and linkdt<=a.date<=coalesce(linkenddt, today()); /*LinkTable Date range conditions*/
quit;
proc download data=CCM_LINK out=common.ccm_link; run;
endrsubmit;

1 REPLY 1
sustagens
Pyrite | Level 9

You'll have to provide more info about your data. What is the format of your date variables? Do a.date, namedt, nameendt linkdt and linkenddt have the same formats?

Also can you please type your code using the Insert SAS code button so it is easier to read, and add an alias for all the variables.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1008 views
  • 1 like
  • 2 in conversation