WRDS currently populates FR Y-9C data quarter by quarter in individual datasets, like BHCF200803, BHCF200806, BHCF200809 and so on. WRDS has not stacked those individual datasets to formulate a single time-series dataset like COMPUSTAT.
There are two ways to overcome this:
- Use the web query on WRDS. The web query allows users to specify a date range and return a single time-series dataset.
- I wrote a SAS script which is equivalent to the web query but with more ease for future update. The code currently can accept a date range and download selected variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
%let wrds = wrds-cloud.wharton.upenn.edu 4016; options comamid=TCP remote=wrds; signon username = _prompt_; libname local "D:\"; rsubmit; %let start = 2008Q1; /*define start quarter */ %let end = 2009Q4; /*define end quarter */ %let var = rssd9001, rssd9999, bhck2170; /*define selected variables */ %macro date_loop(start,end); /*converts the dates to SAS dates*/ %let start=%sysfunc(inputn(&start,anydtdte9.)); %let end=%sysfunc(inputn(&end,anydtdte9.)); /*determines the number of quarters between the two dates*/ %let dif=%sysfunc(intck(quarter,&start,&end)); %do i=0 %to &dif; /*advances the date i quarters from the start date and applies the yymmn. format*/ %let date=%sysfunc(putn(%sysfunc(intnx(quarter,&start,&i,e)),yymmn.)); bank.bhcf&date %end; %mend; data tsbhc; set %date_loop(&start,&end); run; proc sql; create table bhcdata as select &var from tsbhc; quit; proc download data=bhcdata out=local.bhcdata; run; endrsubmit; signoff; |
Thank you so much for the code. It really helps! Just wonder where we can get the link table for crsp and rssd id. The one from the https://www.newyorkfed.org/research/banking_research/datasets.html contains no link for the data.
Wei
Hi Wei, this webpage contains the link to the data (just below Documentation).
Prof. Chen,
Thank you very much! Your code is very helpful!
Best Regards,
Bo Li