1 The SAS System 17:21 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.03 seconds cpu time 0.01 seconds 1 *options obs=55; 2 ** run with sas -sysparm CCYY read_hosp_rpt_alphnmrc ; 3 *options mprint mlogic symbolgen; 4 options mlogic symbolgen; 5 options nocenter; 6 *by Jean Roth, jroth@nber.org, 2007-11-09 ; 7 *NOTE: This program is distributed under the GNU GPL. See end of 8 *this file and http://www.gnu.org/licenses/ for details. ; 9 10 %macro loop(fyear=,lyear=); 11 %let UNDERSCORE=2552_10; 12 %let DASH=2552-10; 13 14 * The following line should contain the directory 15 where the SAS file is to be stored ; 16 17 18 *libname library "~/bulk/cost-reports/hosp/&DASH."; 19 libname library "."; 20 21 * The following line should contain 2 The SAS System 17:21 Monday, April 15, 2019 22 the complete path and name of the raw data file. 23 On a PC, use backslashes in paths as in C:\ ; 24 25 %do year=&FYEAR. %to &LYEAR.; 26 27 %let FILEPATH=/homes/data/hcris/&DASH./hosp10_&year._ALPHA.CSV; 28 proc printto log ="/homes/data/hcris/&DASH./read_hosp_rpt_alpha&year..log" new; 29 proc printto print="/homes/data/hcris/&DASH./read_hosp_rpt_alpha&year..lst" new; 30 FILENAME datafile "&FILEPATH."; 31 32 * The following line should contain the name of the SAS dataset ; 33 %let dataset=hosp_alpha&UNDERSCORE._&year._long ; 34 35 data library.&dataset.; 36 *hosp_dm.* files report lengths; 37 LENGTH rpt_rec_num 5. wksht_cd $7. line_num $5. clmn_num $5. alphnmrc_itm_txt $45. ; 38 * '2C' is hexadecimal for decimal 44 which represents ',' ; 39 * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; 40 infile datafile dsd delimiter='2C0D'x ; 41 INPUT 42 43 rpt_rec_num 44 wksht_cd $ 45 line_num $ 46 clmn_num $ 47 alphnmrc_itm_txt $ 48 49 ; 50 51 proc contents data=library.&dataset.; 52 proc means data=library.&dataset. max n; 53 title "Inspect maximums: Four bytes will retain six significant digits" ; 54 title2 "&dataset."; 55 proc freq data=library.&dataset.; 56 title ""; 57 tables WKSHT_CD LINE_NUM CLMN_NUM ; 58 proc contents data=library.&dataset.; 59 proc sort data=library.&dataset. out=library.uniq_alpha_&year. nodupkey; 60 by wksht_cd clmn_num line_num ; 61 62 %end; 63 %mend; 64 %loop(fyear=2010,lyear=2018); MLOGIC(LOOP): Beginning execution. MLOGIC(LOOP): Parameter FYEAR has value 2010 MLOGIC(LOOP): Parameter LYEAR has value 2018 MLOGIC(LOOP): %LET (variable name is UNDERSCORE) MLOGIC(LOOP): %LET (variable name is DASH) NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V9 Physical Name: /disk/data3/hcris/2552-10 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): %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 3 The SAS System 17:21 Monday, April 15, 2019 SYMBOLGEN: Macro variable YEAR resolves to 2010 NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 1:11.40 19 The SAS System 17:21 Monday, April 15, 2019 cpu time 1:00.77