1 The SAS System 17:22 Monday, April 15, 2019 NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.4 (TS1M3 MBCS3170) Licensed to NATIONAL BUREAU OF ECONOMIC RESEARCH, Site 70111350. NOTE: This session is executing on the Linux 3.10.0-957.1.3.el7.x86_64 (LIN X64) platform. NOTE: Updated analytical products: SAS/STAT 14.1 NOTE: Additional host information: Linux LIN X64 3.10.0-957.1.3.el7.x86_64 #1 SMP Mon Nov 26 12:36:06 CST 2018 x86_64 Scientific Linux release 7.6 (Nitrogen) 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.04 seconds cpu time 0.01 seconds 1 *options obs=55; 2 options mprint mlogic symbolgen; 3 options nocenter ; 4 *by Jean Roth, jroth@nber.org, 2012-12-12 ; 5 *NOTE: This program is distributed under the GNU GPL. See end of 6 *this file and http://www.gnu.org/licenses/ for details. ; 7 8 %macro loop(FYEAR=,LYEAR=); 9 %let DASH=2552-10; 10 %let UNDERSCORE=2552_10; 11 * The following line should contain the directory 12 where the SAS file is to be stored ; 13 14 *libname library "~/bulk/cost-reports/hosp/&DASH."; 15 libname library "."; 16 17 * The following line should contain 18 the complete path and name of the raw data file. 19 On a PC, use backslashes in paths as in C:\ ; 20 21 %do year=&FYEAR. %to &LYEAR.; 2 The SAS System 17:22 Monday, April 15, 2019 22 %put year=&year.; 23 %*let FILEPATH=/homes/data/hcris/&DASH./hosp10_&year._NMRC.CSV; 24 %let FILEPATH=/homes/data/hcris/&DASH./hosp10_&year._NMRC.CSV; 25 26 27 proc printto log ="/homes/data/hcris/&DASH./read_hosp_rpt_nmrc&year..log" new; 28 proc printto print="/homes/data/hcris/&DASH./read_hosp_rpt_nmrc&year..lst" new; 29 30 FILENAME datafile "&FILEPATH."; 31 32 * The following line should contain the name of the SAS dataset ; 33 34 %let dataset = hosp_nmrc&UNDERSCORE._&year._long ; 35 36 37 data library.&dataset.; 38 *hosp_dm.* files report lengths; 39 LENGTH rpt_rec_num 5. wksht_cd $7. line_num $5. clmn_num $5. itm_val_num 7. ; 40 * '2C' is hexadecimal for decimal 44 which represents ',' ; 41 * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; 42 infile datafile dsd delimiter='2C0D'x ; 43 INPUT 44 45 rpt_rec_num 46 wksht_cd $ 47 line_num $ 48 clmn_num $ 49 itm_val_num 50 51 ; 52 53 proc means data=library.&dataset. n max; 54 title "Inspect maximums: Four bytes retain six significant digits" ; 55 run; 56 proc freq data=library.&dataset.; 57 title "" ; 58 tables wksht_cd clmn_num ; 59 proc freq order=freq data=library.&dataset.; 60 title "Ordered by freq" ; 61 tables wksht_cd clmn_num ; 62 proc sort data=library.&dataset; 63 by wksht_cd; 64 proc freq data=library.&dataset.; 65 title ""; 66 tables line_num; 67 by wksht_cd; 68 69 proc freq data=library.&dataset.; 70 tables clmn_num; 71 by wksht_cd; 72 proc sort data=library.&dataset. nodupkey out=library.uniq_nmrc_&year.; 73 by wksht_cd line_num clmn_num ; 74 75 %end; 76 %mend; 77 %loop(FYEAR=2010,LYEAR=2018); MLOGIC(LOOP): Beginning execution. MLOGIC(LOOP): Parameter FYEAR has value 2010 3 The SAS System 17:22 Monday, April 15, 2019 MLOGIC(LOOP): Parameter LYEAR has value 2018 MLOGIC(LOOP): %LET (variable name is DASH) MLOGIC(LOOP): %LET (variable name is UNDERSCORE) MPRINT(LOOP): * The following line should contain the directory where the SAS file is to be stored ; MPRINT(LOOP): *libname library "~/bulk/cost-reports/hosp/&DASH."; MPRINT(LOOP): libname library "."; NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V9 Physical Name: /disk/data3/hcris/2552-10 MPRINT(LOOP): * 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:\ ; SYMBOLGEN: Macro variable FYEAR resolves to 2010 SYMBOLGEN: Macro variable LYEAR resolves to 2018 MLOGIC(LOOP): %DO loop beginning; index variable YEAR; start value is 2010; stop value is 2018; by value is 1. MLOGIC(LOOP): %PUT year=&year. SYMBOLGEN: Macro variable YEAR resolves to 2010 year=2010 MLOGIC(LOOP): %LET (variable name is FILEPATH) SYMBOLGEN: Macro variable DASH resolves to 2552-10 SYMBOLGEN: Macro variable YEAR resolves to 2010 SYMBOLGEN: Macro variable DASH resolves to 2552-10 SYMBOLGEN: Macro variable YEAR resolves to 2010 MPRINT(LOOP): proc printto log ="/homes/data/hcris/2552-10/read_hosp_rpt_nmrc2010.log" new; NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 9:35.86 cpu time 9:25.21