Skip to content

Instantly share code, notes, and snippets.

@edwinhu
Created August 5, 2021 20:44
Show Gist options
  • Save edwinhu/661558a04129b44ec48769e9d8b1e25d to your computer and use it in GitHub Desktop.
Save edwinhu/661558a04129b44ec48769e9d8b1e25d to your computer and use it in GitHub Desktop.
S&P 500 Constituents from CRSP
proc sql;
create table out.sp500 as
select distinct a.permno, a.date,
a.permco,
c.ncusip as CUSIP,
c.exchcd,
c.tsymbol,
c.shrcls
from crsp.msf a,
crsp.msp500list b,
crsp.msenames c
where a.permno = b.permno
and b.start <= a.date <= b.ending
and a.permno = c.permno
and c.namedt <= a.date <= c.nameendt
and year(a.date) ge 2011
order by a.permno, a.date;
quit;
proc print data=&syslast.(obs=25) width=min;run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment