1 The SAS System 18:49 Thursday, May 2, 2013 NOTE: Copyright (c) 2002-2010 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.3 (TS1M0) Licensed to NATIONAL BUREAU OF ECONOMIC RESEARCH, Site 70111350. NOTE: This session is executing on the Linux 2.6.32-358.2.1.el6.x86_64 (LIN X64) platform. 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.05 seconds cpu time 0.01 seconds 1 options nocenter ; 2 options mprint mlogic symbolgen; 3 *by Jean Roth, jroth@nber.org, 2012-12-12 ; 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 7 %macro loop; 8 %let FYEAR = 2010; 9 %let LYEAR = 2011; 10 %let DASH=2552-10; 11 %let UNDERSCORE=2552_10; 12 13 * The following line should contain the directory 14 where the SAS file is to be stored ; 15 16 17 *libname library "~/bulk/cost-reports/hosp/&DASH."; 18 libname library "/homes/data/hcris/2552-10/"; 19 20 * The following line should contain 21 the complete path and name of the raw data file. 22 On a PC, use backslashes in paths as in C:\ ; 23 24 %let FILEPATH=/homes/data/hcris/&DASH./hosp10_&year._ROLLUP.CSV; 25 %do year=&FYEAR. %to &LYEAR.; 26 proc printto log ="/homes/data/hcris/2552-10/read_hosp_rpt_rollup&DASH._&year..log" new; 27 proc printto print="/homes/data/hcris/2552-10/read_hosp_rpt_rollup&DASH._&year..lst" new; 28 29 FILENAME datafile "&FILEPATH."; 2 The SAS System 18:49 Thursday, May 2, 2013 30 31 * The following line should contain the name of the SAS dataset ; 32 33 %let dataset=library.hosp_rollup&year.; 34 35 data &dataset.; 36 37 *hosp_dm.* files report lengths; 38 *Using a length of 4 bytes retains 6 significant digits; 39 *Largest integer represented exactly is 2,097,152; 40 *Maximum values apply to 2002-09-30 data file; 41 *max date is around 16000, do length of 4 should be fine for dates; 42 LENGTH rpt_rec_num 5 label $30; 43 * '2C' is hexadecimal for decimal 44 which represents ',' ; 44 * '0D' is hexadecimal for decimal 13 which represents '\r', which is the carriage return character; 45 infile datafile dsd delimiter='2C0D'x ; 46 ** the ":" is a format modifier that reads data values 47 that need additional instructions from an informat; 48 INPUT 49 rpt_rec_num 50 label $ 51 item 52 ; 53 LABEL 54 rpt_rec_num="Report Record Number" 55 ; 56 proc sort data=&dataset.; 57 by rpt_rec_num; 58 59 proc transpose data=&dataset. out=&dataset. (drop=_NAME_ sortedby=rpt_rec_num); 60 by rpt_rec_num; 61 var item; 62 id label; 63 run; 64 65 proc print DATA=&dataset. (obs=5); 66 proc contents DATA=&dataset.; 67 68 %end; 69 %mend; 70 %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 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 "/homes/data/hcris/2552-10/"; NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V9 Physical Name: /homes/data/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:\ ; MLOGIC(LOOP): %LET (variable name is FILEPATH) SYMBOLGEN: Macro variable DASH resolves to 2552-10 WARNING: Apparent symbolic reference YEAR not resolved. SYMBOLGEN: Macro variable FYEAR resolves to 2010 3 The SAS System 18:49 Thursday, May 2, 2013 SYMBOLGEN: Macro variable LYEAR resolves to 2011 MLOGIC(LOOP): %DO loop beginning; index variable YEAR; start value is 2010; stop value is 2011; by value is 1. 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_rollup2552-10_2010.log" new; NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 1.06 seconds cpu time 0.56 seconds