1 The SAS System 12:32 Wednesday, October 24, 2018 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 2.6.32-696.18.7.el6.x86_64 (LIN X64) platform. NOTE: Updated analytical products: SAS/STAT 14.1 NOTE: Additional host information: Linux LIN X64 2.6.32-696.18.7.el6.x86_64 #1 SMP Wed Jan 3 19:31:16 CST 2018 x86_64 Scientific Linux release 6.9 (Carbon) 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.00 seconds 1 *options obs=55; 2 ** run with sas -sysparm CCYY read_hospc_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; 11 %let FYEAR = 1999; 12 %let LYEAR = 2014; 13 %let UNDERSCORE=1984_99; 14 %let DASH=1984-99; 15 16 * The following line should contain the directory 17 where the SAS file is to be stored ; 18 19 20 libname library "."; 21 2 The SAS System 12:32 Wednesday, October 24, 2018 22 * The following line should contain 23 the complete path and name of the raw data file. 24 On a PC, use backslashes in paths as in C:\ ; 25 26 %do year=&FYEAR. %to &LYEAR.; 27 28 %let FILEPATH=/homes/data/hcris/&DASH./hospc_&year._ALPHA.CSV; 29 proc printto log ="/homes/data/hcris/1984-99/read_hospc_rpt_alpha&year..log" new; 30 proc printto print="/homes/data/hcris/1984-99/read_hospc_rpt_alpha&year..lst" new; 31 FILENAME datafile "&FILEPATH."; 32 33 * The following line should contain the name of the SAS dataset ; 34 %let dataset=hospc_alpha&UNDERSCORE._&year._long ; 35 36 data library.&dataset.; 37 *hospc_dm.* files report lengths; 38 LENGTH rpt_rec_num 5. wksht_cd $7. line_num $5. clmn_num $5. alphnmrc_itm_txt $45. ; 39 * '2C' is hexadecimal for decimal 44 which represents ',' ; 40 * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; 41 infile datafile dsd delimiter='2C0D'x ; 42 INPUT 43 44 rpt_rec_num 45 wksht_cd $ 46 line_num $ 47 clmn_num $ 48 alphnmrc_itm_txt $ 49 50 ; 51 52 proc contents data=library.&dataset.; 53 proc means data=library.&dataset. max n; 54 title "Inspect maximums: Four bytes will retain six significant digits" ; 55 title2 "&dataset."; 56 proc freq data=library.&dataset.; 57 title ""; 58 tables WKSHT_CD LINE_NUM CLMN_NUM ; 59 proc contents data=library.&dataset.; 60 proc sort data=library.&dataset. out=library.uniq_alpha_&year. nodupkey; 61 by wksht_cd clmn_num line_num ; 62 63 %end; 64 %mend; 65 %loop; MLOGIC(LOOP): Beginning execution. MLOGIC(LOOP): %LET (variable name is FYEAR) MLOGIC(LOOP): %LET (variable name is LYEAR) 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/1984-99 SYMBOLGEN: Macro variable FYEAR resolves to 1999 SYMBOLGEN: Macro variable LYEAR resolves to 2014 MLOGIC(LOOP): %DO loop beginning; index variable YEAR; start value is 1999; stop value is 2014; by value is 1. MLOGIC(LOOP): %LET (variable name is FILEPATH) SYMBOLGEN: Macro variable DASH resolves to 1984-99 SYMBOLGEN: Macro variable YEAR resolves to 1999 3 The SAS System 12:32 Wednesday, October 24, 2018 SYMBOLGEN: Macro variable YEAR resolves to 1999 NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 37.44 seconds cpu time 6.50 seconds