options nocenter; libname library "~/bulk/cost-reports/hosp/"; libname out "~/bulk/cost-reports/hosp/"; *libname out "~/bulk/cost-reports/hosp/worksheets"; * by Jean Roth, 2003-12-19 ; * Please report any problems or errors to jroth@nber.org * NOTE: This program is distributed under the GNU GPL. * See http://www.gnu.org/licenses/ for details. ; * Copyright 2004 shared by the National Bureau of Economic Research and Jean Roth ; ** NOTE: Using the generic, not user alphanumeric file because most users do not need a custom numeric file ; %let user=; %macro loop(fyear=,lyear=); %do year=&fyear. %to &lyear.; data merged; merge library.alpha&year.&user.t (sortedby=rpt_rec_num) library.hosp_rpt&year. (in=recent); by rpt_rec_num; fyear=&year.; if recent; data hcris&year.&user.; merge library.nmrc&year.&user.t (sortedby=rpt_rec_num) merged (in=recent); by rpt_rec_num; if recent; %*include "/homes/data/hcris/labels/&user._label.sas"; run; proc sort data=hcris&year.&user. out=out.hcris&year.&user. ; by prvdr_num rpt_rec_num; proc print data=out.hcris&year.&user. (obs=6); proc means data=out.hcris&year.&user. median ; options nolabel; proc means data=out.hcris&year.&user. ; options label; proc contents data=out.hcris&year.&user.; %end; %mend; %*loop(fyear=1995,lyear=2009); %*loop(fyear=1996,lyear=1998); %*loop(fyear=1996,lyear=1997); %*loop(fyear=1998,lyear=1998); %*loop(fyear=1999,lyear=1999); %*loop(fyear=2000,lyear=2005); %*loop(fyear=2006,lyear=2008); %*loop(fyear=2008,lyear=2008); %loop(fyear=2009,lyear=2009);