*options obs=55; options nocenter ; *by Jean Roth, jroth@nber.org, 2007-11-09 ; *NOTE: This program is distributed under the GNU GPL. See end of *this file and http://www.gnu.org/licenses/ for details. ; * The following line should contain the directory where the SAS file is to be stored ; libname library "~/bulk/hcris"; * The following line should contain the complete path and name of the raw data file. On a PC, use backslashes in paths as in C:\ ; %macro loop; %do year=1995 %to 2007; proc printto log ="./read_hosp_rpt_nmrc&year..log"; proc printto print="./read_hosp_rpt_nmrc&year..lst"; FILENAME datafile "/homes/data/hcris/fy/hosp_&year._NMRC.CSV"; * The following line should contain the name of the SAS dataset ; %let dataset = hosp_nmrc_rpt&year._long ; data library.&dataset.; *hosp_dm.* files report lengths; LENGTH rpt_rec_num 4. wksht_cd $7. line_num $5. clmn_num $4. itm_val_num 7. ; * '2C' is hexadecimal for decimal 44 which represents ',' ; * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; infile datafile dsd delimiter='2C0D'x ; INPUT rpt_rec_num wksht_cd $ line_num $ clmn_num $ itm_val_num ; proc means data=library.&dataset. n max; title "Inspect maximums: Four bytes retain six significant digits" ; run; proc freq data=library.&dataset.; title "" ; tables wksht_cd clmn_num ; proc sort data=library.&dataset. nodupkey out = &dataset. ; by wksht_cd line_num clmn_num ; proc print data=&dataset. noobs ; var wksht_cd clmn_num line_num; %end; %mend; %loop; /* Copyright 2007 shared by Jean Roth and the National Bureau of Economic Research National Bureau of Economic Research. 1050 Massachusetts Avenue Cambridge, MA 02138 jroth@nber.org This program and all programs referenced in it are free software. You can redistribute the program or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */