Dear Sir, I wish to create industry dummies from the 64602 observations from file industry.sum below: Column 1=observation no, column 2: industries code var=sic2; column 3= frequencies of each industries 1 1 114 2 2 28 3 7 27 4 8 10 5 9 6 6 10 754 7 12 138 8 13 1858 9 14 126 10 15 243 11 16 175 12 17 113 13 20 1080 14 21 88 15 22 130 16 23 435 17 24 207 18 25 270 19 26 442 20 27 476 21 28 4906 22 29 374 23 30 402 24 31 178 25 32 231 26 33 645 27 34 533 28 35 2692 29 36 4477 30 37 1015 31 38 3177 32 39 427 33 40 124 34 41 27 35 42 332 36 44 464 37 45 362 38 46 75 39 47 190 40 48 2058 41 49 1696 42 50 979 43 51 596 44 52 63 45 53 271 46 54 237 47 55 248 48 56 547 49 57 194 50 58 673 51 59 901 52 60 6436 53 61 590 54 62 797 55 63 1606 56 64 214 57 65 454 58 67 8892 59 70 194 60 72 156 61 73 6216 62 75 95 63 76 12 64 78 198 65 79 438 66 80 820 67 81 10 68 82 244 69 83 78 70 86 2 71 87 1007 72 99 329 my industries dummy should be coded as ind01, ind02, ind03 ...ind72, ie following the observation no, instead of following the sic2 codes. I have the following codes but i m not sure how do i modify the prog codes to following the observation no, pls help me: proc sql noprint; select distinct cats('ind',sic2) into : list separated by ' ' from industry.sum; quit; data industry.spi; set spi.spi5; array _y &list ; do over _y; _y=ifn(sic2=compress(vname(_y),,'kd'), 1,0); end; run; or using codes as below: data industry.spi2; set spi.spi5; array _y{*} &list ; do i=1 to dim(_y); _y{i}=0 ; end; do i=1 to dim(_y); if fyear=input(compress(vname(_y{i}),'yr'),best8.) then _y{i}=1; end; drop i; run;
... View more