1 The SAS System 10:51 Wednesday, March 18, 2009 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 THE CURATORS OF THE UNIV OF MISSOURI - T&R, Site 0001242018. NOTE: This session is executing on the AIX 5.2 platform. NOTE: SAS 9.1.3 Service Pack 4 NOTE: SAS initialization used: real time 0.24 seconds cpu time 0.11 seconds NOTE: AUTOEXEC processing beginning; file is /home/john/autoexec.sas. v8= 0 v9= 1 ***** ****** Standard OSEDA/MCDC autoexec (autoexec9.sas in sascode) rev. 12/28/2004 3:06PM - Begin execution ******* _v9= v9 Standard filerefs and librefs assigned ***** NOTE: Libref SF32000X was successfully assigned as follows: Levels: 1 Engine(1): V9 Physical Name(1): /pub/data/sf32000x NOTE: Libref SF3X was successfully assigned as follows: Levels: 1 Engine(1): V9 Physical Name(1): /pub/data/sf32000x NOTE: Libref INDCTRS was successfully assigned as follows: Levels: 1 Engine(1): V9 Physical Name(1): /pub/data/indctrs NOTE: Libname LIBRARY refers to the same physical library as SASCTLGS. NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V9 Physical Name: /pub/sasctlgs/v9 ****Finished with generic autoexec **** *** ****Executing my private autoexec.sas file, rev. 02/28/2006 7:40AM WARNING: Library MAPS is not assigned in this scope. WARNING: Library GISMAPS is not assigned in this scope. ***** dmsflag= NODMS dmchk execution begins *** **Begin execution on Wednesday 18MAR09 at 10:51 PID=266246 NOTE: AUTOEXEC processing completed. 1 x cd /pub/data/sf32000/Tools 1 ! ; %let pgm=create_variables_metadata; filename pgm "&pgm..sas"; 2 The SAS System 10:51 Wednesday, March 18, 2009 2 *----We attempt to recreate the lost variablesXXX metadata datasets that were lost in the crash of 2-24-09. We read 2 ! the 4 Varlabs 3 files as our source. We use a setup from the acs2007 tools lib as a template as we try to recapture the same 3 ! variables. 4 ----*; 5 libname sf3 '/pub/data/sf32000/'; NOTE: Libref SF3 was successfully assigned as follows: Engine: V9 Physical Name: /pub/data/sf32000 6 libname sf32000 '/pub/data/sf32000'; NOTE: Libname SF32000 refers to the same physical library as SF3. NOTE: Libref SF32000 was successfully assigned as follows: Engine: V9 Physical Name: /pub/data/sf32000 7 libname user '/tmp/scratch/user'; NOTE: Libref USER was successfully assigned as follows: Engine: V9 Physical Name: /tmp/scratch/user 8 9 10 title "&pgm: Generate Variable level metadata for sf32000 data sets"; 11 12 /* =======================Begin comment================ 13 proc contents data=sf3.moph(drop=_character_) noprint out=cph(keep=name label formatl formatd); 14 proc contents data=sf3.mophct(drop=_character_) noprint out=cphct(keep=name label formatl formatd); 15 proc contents data=sf3.mophctr(drop=_character_) noprint out=cphctr(keep=name label formatl formatd); 16 ======================End comment================== */ 17 18 *data variablesph; 19 * length TableID $8 TableName $240 Universe $140 TableType $3 TableNo 3 TableRSfx $1 Name $32 Label $256 20 format $8 TableCell IndentLevel NcellsInTable 3; 21 * set cph; 22 23 %macro tabmeta(type); 24 %local typelen typelenp1; 25 26 %if &type=ph %then 27 %str( filename in ('/pub/data/sf32000/Varlabs/Hlabels.txt', '/pub/data/sf32000/Varlabs/Plabels.txt');); 28 %else %if &type=phct %then 29 %str( filename in ('/pub/data/sf32000/Varlabs/HCTlabels.txt', '/pub/data/sf32000/Varlabs/PCTlabels.txt');); 30 %else %do; 31 data _null_; put "&type is not a valid parm value for tabmeta macro ************************* "; abort abend; run; 32 %end; 33 34 35 data table_titles&type; 36 infile in lrecl=255 length=_lrec; 37 link get1; 38 length TableSeqNo 4 TableID $8 TableName $240 Universe $140 TableType $3 TableNo 3 TableRSfx $1; 39 length _l $255; 40 retain; 41 %if &type=ph %then %do; 42 %let typelen=1; 43 if substr(_l,1,1) in ("P","H") then do; 44 %end; 45 %else %do; 3 The SAS System 10:51 Wednesday, March 18, 2009 46 %let typelen=3; 47 if substr(_l,1,3) in ("PCT","HCT") then do; 48 %end; 49 %let typelenp1=%eval(&typelen +1); 50 *--we have a table title (first line) spec---; 51 TableId=scan(_l,1,'.'); 52 TableType=substr(TableID,1,&typelen); 53 length _tspec $8; _tspec=substr(TableId,&typelenp1); 54 if verify(trim(_tspec),'0123456789') then do; 55 TableNo=substr(_tspec,1,length(_tspec)- 1); TableRSfx=substr(_tspec,length(_tspec),1); 56 end; 57 else do; 58 TableNo=substr(TableID,&typelenp1); *--convert on assignment--; 59 TableRSfx=' '; 60 end; 61 Universe=' '; NCellsinTable=.; 62 _idot=index(_l,'.'); 63 TableName=substr(_l,_idot+2); 64 _ib=index(TableName,'['); 65 **if _ib=0 then do; _nex=0; 66 do while (_ib=0 and _nex <=4 ); 67 link get1; _nex+1; 68 TableName=trim(TableName)||' '||left(_l); 69 _ib=index(TableName,'['); 70 end; 71 if _ib then NCellsinTable=scan(substr(TableName,_ib+1),1,']'); 72 end; 73 else if _l=:'Universe:' then do; 74 Universe=left( substr(_l, 11) ); 75 input @@; 76 if _infile_=:'/* ' then do; *---continuation line recognized---; 77 Universe=trim(universe)||left( substr(_infile_,3,length(_infile_)-4)); 78 input; *--release trailing @@ so we start with a new input line next time. Otherwise we hold this line--; 79 end; 80 TableSeqNo+1; 81 output; 82 _nout+1; if _nout le 5 then put / _all_; *<====================; 83 end; 84 return; 85 86 get1: 87 do until(_first2='/*'); 88 input ; if _infile_ eq ' ' | _lrec=1 then _first2=' '; else _first2 =substr(_infile_,1,2); 89 end; 90 _l=substr(_infile_,4); *--remove the leading 3 chars--; 91 _l=substr(_l,1,length(_l)-2); *---remove asterisk slash at the end of line--; 92 *** put '***get1 returning: ' _l $char90.; *<====temp=========; 93 return; 94 drop _: ; 95 run; 96 %mend tabmeta; 97 98 /* =======================Begin comment================ 99 options nomprint; 100 %tabmeta(ph) ; 101 %tabmeta(phct) ; 4 The SAS System 10:51 Wednesday, March 18, 2009 102 ======================End comment================== */ 103 104 data vars; 105 set cph cphct cphctr ; 106 length TableId $8 format $8 IndentLevel 3; 107 if name=:'P' or name=:'H'; 108 _i=index(name,'i'); 109 if _i; 110 tableid=substr(name,1,_i-1); 111 _nblanks=length(label) - length( left(label)); 112 IndentLevel=_nblanks/2; 113 if mod(_nblanks,2)=1 then do; 114 _nbad+1; if _nbad <=10 then put _all_; else abort abend; 115 end; 116 drop _: ; 117 if formatl then format= left (put(formatl,3.))||'.'||left(put(formatd,2.)); *--e.g. "5.1" --; 118 drop formatl formatd; 119 run; NAME=H70i1 LABEL=income in 1999 FORMATL=0 FORMATD=0 TableId=H70 format= IndentLevel=0.5 _i=4 _nblanks=1 _nbad=1 _ERROR_=0 _N_=913 NAME=P70i1 LABEL=income in 1999 FORMATL=0 FORMATD=0 TableId=P70 format= IndentLevel=0.5 _i=4 _nblanks=1 _nbad=2 _ERROR_=0 _N_=5137 NOTE: There were 5568 observations read from the data set USER.CPH. NOTE: There were 4402 observations read from the data set USER.CPHCT. NOTE: There were 6580 observations read from the data set USER.CPHCTR. NOTE: The data set USER.VARS has 16520 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 1.07 seconds cpu time 0.55 seconds 120 proc sort data=vars; by tableid; run; NOTE: There were 16520 observations read from the data set USER.VARS. NOTE: The data set USER.VARS has 16520 observations and 5 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.91 seconds cpu time 0.79 seconds 121 122 data table_titles; set table_titlesph table_titlesphct; run; NOTE: There were 409 observations read from the data set USER.TABLE_TITLESPH. NOTE: There were 404 observations read from the data set USER.TABLE_TITLESPHCT. NOTE: The data set USER.TABLE_TITLES has 813 observations and 8 variables. NOTE: DATA statement used (Total process time): real time 0.26 seconds cpu time 0.04 seconds 123 proc sort data=table_titles; by tableId; run; NOTE: There were 813 observations read from the data set USER.TABLE_TITLES. NOTE: The data set USER.TABLE_TITLES has 813 observations and 8 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.18 seconds 5 The SAS System 10:51 Wednesday, March 18, 2009 cpu time 0.03 seconds 124 125 126 data sf3.variablesph 127 sf3.variablesphct 128 sf3.variablesphctr; 129 merge table_titles (in=intables) 130 vars (in=invars); 131 by tableId; 132 length TableCell 3; 133 if not (intables and invars) then do; 134 _nbad+1; 135 put "**Match failure: " intables= invars= tableID= name= ; 136 if _nbad ge 20 then abort abend; 137 end; 138 if first.tableid then TableCell=1; else TableCell+1; 139 if length (tabletype)=1 then output sf3.variablesph; 140 else if TableRsfx ne ' ' then output sf3.variablesphctr; 141 else output sf3.variablesphct; 142 drop _: ; 143 run; NOTE: There were 813 observations read from the data set USER.TABLE_TITLES. NOTE: There were 16520 observations read from the data set USER.VARS. NOTE: The data set SF3.VARIABLESPH has 5558 observations and 13 variables. NOTE: The data set SF3.VARIABLESPHCT has 4392 observations and 13 variables. NOTE: The data set SF3.VARIABLESPHCTR has 6570 observations and 13 variables. NOTE: DATA statement used (Total process time): real time 0.59 seconds cpu time 0.30 seconds 144 145 proc print data=sf3.variablesph(obs=250); 146 title2 "sf3.variablesph"; 147 by tableid tableName universe; 148 format tableName universe $40.; 149 id tableCell; 150 run; NOTE: There were 250 observations read from the data set SF3.VARIABLESPH. NOTE: The PROCEDURE PRINT printed pages 1-10. NOTE: PROCEDURE PRINT used (Total process time): real time 0.04 seconds cpu time 0.04 seconds 151 152 153 154 155 156 157 6 The SAS System 10:51 Wednesday, March 18, 2009 158 159 160 161 %include sascode(notify); 0 **** create_variables_metadata (266246) has completed 18MAR09 10:51:07 syserr=0 sysrc= 0 ***** NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 3.59 seconds cpu time 2.00 seconds