1 The SAS System 22:05 Sunday, May 14, 2006 NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) 9.1 (TS1M3) Licensed to UNIV OF CA/BERKELEY, Site 0029107012. NOTE: This session is executing on the SunOS 5.8 platform. NOTE: SAS 9.1.3 Service Pack 3 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 Welcome to SAS 9.1.3 licensed to the UCB Demography Lab For a short time it will be possible to run the old version of sas by typing sas81. Soon, however, this will be the only version availalbe -- I sure hope you like it. NOTE: SAS initialization used: real time 0.34 seconds cpu time 0.08 seconds 1 2 libname zh '~/taiwan/fies/sasdata'; NOTE: Libref ZH was successfully assigned as follows: Engine: V9 Physical Name: /home/brass/hdir0/ebenstei/taiwan/fies/sasdata 2 ! 3 options ls=72; 4 5 %macro one(q); 6 7 /* The data from Taiwan is in card-image format: each 7 ! observation 8 has variable values spread over up to 99 lines, with a 8 ! variable # 9 of lines per observation, depending on the amount of 9 ! available info 10 for that household. Hence the complexity of the following 10 ! extract */ 11 12 DATA 13 head (KEEP=hhid 14 areacode urban serial agrtype agr_area 14 ! agr_work 15 weight ) 16 people (KEEP=hhid 17 person relate sex age educ 17 ! grad 18 empact empind empocc part empsoc 2 The SAS System 22:05 Sunday, May 14, 2006 18 ! empsta 19 empsit earner marry outpat discrg 19 ! insnhi 20 ins1si ins1ms ins2si ins2ms 21 ii ) 22 consume (KEEP=hhid 23 colortv ldcdplay video stereo piano 23 ! videogam 24 vcr cable computer tele answer 24 ! fax 25 modem auto motorcyc oven acheat 25 ! dehumid 26 washer drier dishwash kitchfan vaccum 26 ! geyser 27 fountain microwav newspap periodic ) 28 house (KEEP=hhid 29 ownhome rental allocate otherown 29 ! res_use bus_use 30 otheruse story_1 story_23 story_45 30 ! story_6 wateruse 31 nowater loan noloan ownpark 31 ! rentpark nopark 32 landarea bldarea leasres leasbus 32 ! leasboth noleas ) 33 marker (KEEP=hhid 34 daiha value jj ); 35 36 LENGTH DEFAULT=6; * a length of 6 was chosen because 36 ! the 37 largest potential integer is 11 37 ! characters long; 38 39 filename myfile "~/taiwan/fies/rawdata/tpis&q..dat"; 40 INFILE myfile; 41 42 INPUT line 79-80 @; * line number is unique identifier for 42 ! each line; 43 44 RETAIN ii jj 0; 45 46 IF line=1 THEN DO; 47 ii=0; * Counter for the person data set; 48 jj=0; * Counter for the inc, cons, & capital data sets; 49 INPUT hhid $ 1-8 50 areacode 1-2 urban 3 serial $ 4-8 agrtype 9 51 agr_area 10 agr_work 11 weight 74-78; 52 OUTPUT head; 53 RETURN; 54 END; 55 56 ELSE IF 2<=line<=20 THEN DO; 57 INPUT hhid $ 1-8 58 person 9-10 relate 11-12 sex 13 age 14-16 59 educ 17-18 grad 19 empact 20 empind 21-22 60 empocc 23-24 part 25 empsoc 26-27 empsta 28 61 empsit 29 earner 30 marry 33-34 outpat 35-36 62 discrg 37-38 insnhi 39-40 ins1si 54-55 ins1ms 56-57 63 ins2si 58-59 ins2ms 60-61 ; 3 The SAS System 22:05 Sunday, May 14, 2006 64 ii=ii+1; * start iterating at ii=1,2,3,... ; 65 OUTPUT people; 66 RETURN; 67 END; 68 69 ELSE IF line=21 THEN DO; 70 INPUT hhid $ 1-8 71 colortv 9-10 ldcdplay 11-12 video 13-14 stereo 71 ! 15-16 72 piano 17-18 videogam 19-20 vcr 21-22 cable 72 ! 23-24 73 computer 25-26 tele 27-28 answer 29-30 fax 73 ! 31-32 74 modem 33-34 auto 35-36 motorcyc 37-38 oven 74 ! 39-40 75 acheat 41-42 dehumid 43-44 washer 45-46 drier 75 ! 47-48 76 dishwash 49-50 kitchfan 51-52 vaccum 53-54 geyser 76 ! 55-56 77 fountain 57-58 microwav 59-60 newspap 61-62 periodic 77 ! 63-64; 78 OUTPUT consume; 79 RETURN; 80 END; 81 82 ELSE IF line=22 THEN DO; 83 INPUT hhid $ 1-8 84 ownhome 9 rental 10 allocate 11 otherown 12 85 res_use 13 bus_use 14 otheruse 15 story_1 19 86 story_23 20 story_45 21 story_6 22 wateruse 23 87 nowater 24 loan 29 noloan 30 ownpark 31 88 rentpark 32 nopark 33 landarea 36-38 bldarea 88 ! 39-41 89 leasres 56 leasbus 57 leasboth 58 noleas 59; 90 OUTPUT house; 91 RETURN; 92 END; 93 94 ELSE IF 23<=line<=99 THEN DO; 95 INPUT hhid $ 1-8 daiha 9-11 @12 value zd11. @; 96 jj=jj+1; * start iterating at jj=1,6,11,16,... ; 97 OUTPUT marker; 98 INPUT hhid $ 1-8 daiha 23-25 @26 value zd11. @; 99 jj=jj+1; * start iterating at jj=2,7,12,17,... ; 100 OUTPUT marker; 101 INPUT hhid $ 1-8 daiha 37-39 @40 value zd11. @; 102 jj=jj+1; * start iterating at jj=3,8,13,18,... ; 103 OUTPUT marker; 104 INPUT hhid $ 1-8 daiha 51-53 @54 value zd11. @; 105 jj=jj+1; * start iterating at jj=4,9,14,19,... ; 106 OUTPUT marker; 107 INPUT hhid $ 1-8 daiha 65-67 @68 value zd11. ; 108 jj=jj+1; * start iterating at jj=5,10,15,20,...; 109 OUTPUT marker; 110 RETURN; 111 END; 112 113 PROC SORT DATA=head; 4 The SAS System 22:05 Sunday, May 14, 2006 114 BY hhid; 115 PROC SORT DATA=people; 116 BY hhid ii; 117 PROC SORT DATA=consume; 118 BY hhid; 119 PROC SORT DATA=house; 120 BY hhid; 121 PROC SORT DATA=marker; 122 BY hhid jj; 123 124 PROC TRANSPOSE DATA=people OUT=people2 PREFIX=new1; 125 BY hhid ii; 126 PROC TRANSPOSE DATA=marker OUT=marker2 PREFIX=new2; 127 BY hhid jj; 128 129 DATA people2; 130 LENGTH DEFAULT=6; 131 SET people2; 132 var1=TRIM(_name_)||TRIM(ii); 133 var1=COMPRESS(var1); 134 DROP _name_ ii; 135 DATA marker2; 136 LENGTH DEFAULT=6; 137 SET marker2; 138 var2=TRIM(_name_)||TRIM(jj); 139 var2=COMPRESS(var2); 140 DROP _name_ jj; 141 142 PROC TRANSPOSE DATA=people2 OUT=people2; 143 BY hhid; 144 ID var1; 145 PROC TRANSPOSE DATA=marker2 OUT=marker2; 146 BY hhid; 147 ID var2; 148 149 DATA zh.data&q; 150 LENGTH DEFAULT=6; 151 MERGE head people2 consume house 152 marker2; 153 BY hhid; 154 155 PROC CONTENTS; 156 run; 157 158 %mend; 159 160 %one(02); NOTE: The infile MYFILE is: File Name=/home/brass/hdir0/ebenstei/taiwan/fies/rawdata/tpis02.dat, Owner Name=ebenstei,Group Name=leenta, Access Permission=rw-rw-r--, File Size (bytes)=41521192 NOTE: 506356 records were read from the infile MYFILE. The minimum record length was 81. 5 The SAS System 22:05 Sunday, May 14, 2006 The maximum record length was 81. NOTE: The data set WORK.HEAD has 13681 observations and 8 variables. NOTE: The data set WORK.PEOPLE has 49510 observations and 24 variables. NOTE: The data set WORK.CONSUME has 13681 observations and 29 variables. NOTE: The data set WORK.HOUSE has 13681 observations and 25 variables. NOTE: The data set WORK.MARKER has 2079015 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 9.92 seconds cpu time 5.09 seconds NOTE: There were 13681 observations read from the data set WORK.HEAD. NOTE: The data set WORK.HEAD has 13681 observations and 8 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.17 seconds cpu time 0.05 seconds NOTE: There were 49510 observations read from the data set WORK.PEOPLE. NOTE: The data set WORK.PEOPLE has 49510 observations and 24 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.56 seconds cpu time 0.25 seconds NOTE: There were 13681 observations read from the data set WORK.CONSUME. NOTE: The data set WORK.CONSUME has 13681 observations and 29 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.24 seconds cpu time 0.08 seconds NOTE: There were 13681 observations read from the data set WORK.HOUSE. NOTE: The data set WORK.HOUSE has 13681 observations and 25 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.24 seconds cpu time 0.06 seconds NOTE: There were 2079015 observations read from the data set WORK.MARKER. NOTE: The data set WORK.MARKER has 2079015 observations and 4 variables. NOTE: PROCEDURE SORT used (Total process time): real time 11.04 seconds cpu time 9.13 seconds NOTE: There were 49510 observations read from the data set WORK.PEOPLE. NOTE: The data set WORK.PEOPLE2 has 1089220 observations and 4 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 2.56 seconds cpu time 1.20 seconds 6 The SAS System 22:05 Sunday, May 14, 2006 NOTE: There were 2079015 observations read from the data set WORK.MARKER. NOTE: The data set WORK.MARKER2 has 4158030 observations and 4 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 36.29 seconds cpu time 21.32 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 160:83 NOTE: There were 1089220 observations read from the data set WORK.PEOPLE2. NOTE: The data set WORK.PEOPLE2 has 1089220 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 5.14 seconds cpu time 2.52 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 160:210 NOTE: There were 4158030 observations read from the data set WORK.MARKER2. NOTE: The data set WORK.MARKER2 has 4158030 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 19.89 seconds cpu time 9.84 seconds NOTE: There were 1089220 observations read from the data set WORK.PEOPLE2. NOTE: The data set WORK.PEOPLE2 has 13681 observations and 398 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 20.14 seconds cpu time 11.19 seconds NOTE: There were 4158030 observations read from the data set WORK.MARKER2. NOTE: The data set WORK.MARKER2 has 13681 observations and 632 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 1:09.02 cpu time 42.12 seconds 7 The SAS System 22:05 Sunday, May 14, 2006 NOTE: There were 13681 observations read from the data set WORK.HEAD. NOTE: There were 13681 observations read from the data set WORK.PEOPLE2. NOTE: There were 13681 observations read from the data set WORK.CONSUME. NOTE: There were 13681 observations read from the data set WORK.HOUSE. NOTE: There were 13681 observations read from the data set WORK.MARKER2. NOTE: The data set ZH.DATA02 has 13681 observations and 1087 variables. NOTE: DATA statement used (Total process time): real time 7.35 seconds cpu time 3.88 seconds NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.22 seconds cpu time 0.13 seconds NOTE: The PROCEDURE CONTENTS printed pages 1-22. 161 %one(03); NOTE: The infile MYFILE is: File Name=/home/brass/hdir0/ebenstei/taiwan/fies/rawdata/tpis03.dat, Owner Name=ebenstei,Group Name=leenta, Access Permission=rw-rw-r--, File Size (bytes)=41211642 NOTE: 502581 records were read from the infile MYFILE. The minimum record length was 81. The maximum record length was 81. NOTE: The data set WORK.HEAD has 13681 observations and 8 variables. NOTE: The data set WORK.PEOPLE has 47959 observations and 24 variables. NOTE: The data set WORK.CONSUME has 13681 observations and 29 variables. NOTE: The data set WORK.HOUSE has 13681 observations and 25 variables. NOTE: The data set WORK.MARKER has 2067895 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 10.41 seconds cpu time 5.01 seconds NOTE: There were 13681 observations read from the data set WORK.HEAD. NOTE: The data set WORK.HEAD has 13681 observations and 8 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.18 seconds cpu time 0.05 seconds NOTE: There were 47959 observations read from the data set WORK.PEOPLE. NOTE: The data set WORK.PEOPLE has 47959 observations and 24 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.50 seconds cpu time 0.24 seconds 8 The SAS System 22:05 Sunday, May 14, 2006 NOTE: There were 13681 observations read from the data set WORK.CONSUME. NOTE: The data set WORK.CONSUME has 13681 observations and 29 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.25 seconds cpu time 0.05 seconds NOTE: There were 13681 observations read from the data set WORK.HOUSE. NOTE: The data set WORK.HOUSE has 13681 observations and 25 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.23 seconds cpu time 0.06 seconds NOTE: There were 2067895 observations read from the data set WORK.MARKER. NOTE: The data set WORK.MARKER has 2067895 observations and 4 variables. NOTE: PROCEDURE SORT used (Total process time): real time 10.67 seconds cpu time 8.64 seconds NOTE: There were 47959 observations read from the data set WORK.PEOPLE. NOTE: The data set WORK.PEOPLE2 has 1055098 observations and 4 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 2.83 seconds cpu time 1.23 seconds NOTE: There were 2067895 observations read from the data set WORK.MARKER. NOTE: The data set WORK.MARKER2 has 4135790 observations and 4 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 33.12 seconds cpu time 20.63 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 161:83 NOTE: There were 1055098 observations read from the data set WORK.PEOPLE2. NOTE: The data set WORK.PEOPLE2 has 1055098 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 4.86 seconds cpu time 2.34 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 9 The SAS System 22:05 Sunday, May 14, 2006 161:210 NOTE: There were 4135790 observations read from the data set WORK.MARKER2. NOTE: The data set WORK.MARKER2 has 4135790 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 19.50 seconds cpu time 9.55 seconds NOTE: There were 1055098 observations read from the data set WORK.PEOPLE2. NOTE: The data set WORK.PEOPLE2 has 13681 observations and 310 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 17.83 seconds cpu time 10.58 seconds NOTE: There were 4135790 observations read from the data set WORK.MARKER2. NOTE: The data set WORK.MARKER2 has 13681 observations and 602 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 1:04.02 cpu time 42.02 seconds NOTE: There were 13681 observations read from the data set WORK.HEAD. NOTE: There were 13681 observations read from the data set WORK.PEOPLE2. NOTE: There were 13681 observations read from the data set WORK.CONSUME. NOTE: There were 13681 observations read from the data set WORK.HOUSE. NOTE: There were 13681 observations read from the data set WORK.MARKER2. NOTE: The data set ZH.DATA03 has 13681 observations and 969 variables. NOTE: DATA statement used (Total process time): real time 6.55 seconds cpu time 3.72 seconds NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.63 seconds cpu time 0.08 seconds NOTE: The PROCEDURE CONTENTS printed pages 23-42. 162 NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 5:55.14 cpu time 3:31.24