1 The SAS System 15:51 Thursday, December 16, 2010 NOTE: Unable to open SASUSER.REGSTRY. WORK.REGSTRY will be opened instead. NOTE: All registry changes will be lost at the end of the session. WARNING: Unable to copy SASUSER registry to WORK registry. Because of this, you will not see registry customizations during this session. NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) 9.1 (TS1M3) Licensed to HARVARD UNIV - SCHOOL OF PUBLIC HEALTH - T&R, Site 0001177014. NOTE: This session is executing on the SunOS 5.10 platform. NOTE: SAS 9.1.3 Service Pack 3 ----------------------------------------------------------------------- NBER NOTE: sas now defaults to sas9. sas8 or sas6 will invoke sas version 8 or 6 respectively. - 2005/10/21 ----------------------------------------------------------------------- You are running SAS 9. Some SAS 8 files will be automatically converted by the V9 engine; others are incompatible. Please see http://support.sas.com/rnd/migration/planning/platform/64bit.html PROC MIGRATE will preserve current SAS file attributes and is recommended for converting all your SAS libraries from any SAS 8 release to SAS 9. For details and examples, please see http://support.sas.com/rnd/migration/index.html This message is contained in the SAS news file, and is presented upon initialization. Edit the file "news" in the "misc/base" directory to display site-specific news and information in the program log. The command line option "-nonews" will prevent this display. NOTE: SAS initialization used: real time 0.20 seconds cpu time 0.06 seconds 1 *options obs=55; 2 options nocenter ; 3 *by Jean Roth, jroth@nber.org, 2007-11-09 ; 4 *NOTE: This program is distributed under the GNU GPL. See end of 5 *this file and http://www.gnu.org/licenses/ for details. ; 6 ** run with sysparm option as is sas -sysparm 2010 read_rpt_nmrc.sas ; 7 8 %macro loop(ty=); 9 %do year=&SYSPARM. %to &SYSPARM.; 10 proc printto log ="read_&ty._rpt_nmrc&year..log" new; 11 proc printto print="read_&ty._rpt_nmrc&year..lst" new; 12 13 * The following line should contain the directory 14 where the SAS file is to be stored ; 15 16 libname library "~/bulk/cost-reports/&ty./"; 17 18 * The following line should contain 2 The SAS System 15:51 Thursday, December 16, 2010 19 the complete path and name of the raw data file. 20 On a PC, use backslashes in paths as in C:\ ; 21 22 FILENAME datafile "/homes/data/hcris/&ty./&ty._&year._NMRC.CSV"; 23 24 * The following line should contain the name of the SAS dataset ; 25 26 %let dataset = &ty._nmrc_rpt&year._long ; 27 28 data library.&dataset.; 29 *hosp_dm.* files report lengths; 30 LENGTH rpt_rec_num 4. wksht_cd $7. line_num $5. clmn_num $4. itm_val_num 7. ; 31 * '2C' is hexadecimal for decimal 44 which represents ',' ; 32 * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; 33 infile datafile dsd delimiter='2C0D'x ; 34 INPUT 35 36 rpt_rec_num 37 wksht_cd $ 38 line_num $ 39 clmn_num $ 40 itm_val_num 41 42 ; 43 44 proc means data=library.&dataset. n max; 45 title "Inspect maximums: Four bytes retain six significant digits" ; 46 run; 47 proc freq data=library.&dataset.; 48 title "" ; 49 tables wksht_cd clmn_num ; 50 proc freq order=freq data=library.&dataset.; 51 title "Ordered by freq" ; 52 tables wksht_cd clmn_num ; 53 proc sort data=library.&dataset; 54 by wksht_cd; 55 proc freq data=library.&dataset.; 56 title ""; 57 tables line_num; 58 by wksht_cd; 59 60 proc freq data=library.&dataset.; 61 tables clmn_num; 62 by wksht_cd; 63 proc sort data=library.&dataset. nodupkey out=library.uniq_nmrc_&year.; 64 by wksht_cd line_num clmn_num ; 65 66 %end; 67 %mend; 68 *%loop(ty=hha); 69 *%loop(ty=hosp); 70 *%loop(ty=rnl); 71 %loop(ty=snf); NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 13:22.16 cpu time 59.14 seconds