/********************************************************************* NOTE: You can copy this to a file directly from here, and use the program shown below as a sample, so that it need not be re-typed entirely. Depending on your browser, you can probably click 'File' then 'Save As' to save this into a usable file. ********************************************************************** This program reads all variables in the 1980 STF1A Census data into a SAS data set. To read in a subset, delete the line(s) containing the variables you don't want. To choose only certain observations (for example, using the SUMRYLVL variable), add IF statements in the designated section at the very end of the DATA step (bottom of the program). Please note that this program is provided WITHOUT guarantee of its accuracy. **********************************************************************/ /********************************************************************/ /*** the LIBNAME statement points to /tmp -- this can be **** changed to any directory that is large enough ***/ LIBNAME SAVER '/tmp'; options nocenter ls=79; FILENAME RAW1A80 '~datastor/census/census1980/census80.stf1a'; DATA SAVER.CEN1A80; length tractnum $ 8; INFILE RAW1A80 LRECL=1638; /* each rec=1638, 2 physical recs per observ.*/ INPUT /************* RECORD SEGMENT 1 ***********************************/ FILEID $ 1- 5 /*** STF1A ***/ RECTYP 6- 9 /*** RECTYP field is blank in STF1 ***/ SUMRYLVL 10-11 /*** geographic level of the current record ***/ URBARURL 12-13 /*** urban/rural component ***/ SMSACOM 14-15 /*** inside/outside SMSAs component ***/ RACESPAN 16-17 /*** RACESPAN field is blank in STF1 ***/ ANCESTRY 18-20 /*** ANCESTRY field is blank in STF1 ***/ BLOCKPT 21 /*** block portion indicator ***/ FSTATUS $ 22 /*** functional status code ***/ FLAG1 23 PARTCOU 24 /*** New England only, otherwise blank ***/ FILLER1 25-28 PSAD $ 29 /*** political/statistical area description ***/ FILLER1A 30 REGION 31 /*** region of country ****/ DIVISION 32 /*** first digit of state code (next variable) ***/ STATEGEO 32-33 /*** geographic state code ***/ STATE 34-35 /*** FIPS state code ***/ SMSA 36-39 /*** Standard Metropolitan Statistical Area ***/ COUNTY $ 40-42 /*** FIPS county code ***/ MCD 43-45 /*** Minor Civil Division ***/ PLACE 46-49 /*** Census geographic place code ***/ TRACT $ 50-55 /*** tract with optional two-digit suffix ***/ TRACT4 $ 50-53 /*** 4-digit basic tract code ***/ TRACT2 $ 54-55 /*** 2-digit suffix tract code ***/ BLKGRP 56 /*** block group -- first digit of block number ***/ BLOCK 56-58 /*** block number ***/ PARTPLAC 59 /*** place/part indicator ***/ PARTTRCT 60 /*** tract/part indicator ***/ PARTBLK 61 /*** block/part indicator ***/ EDIND $ 62 /*** enumeration district indicator prefix ***/ EDNUMBER 63-66 /*** enumeration district number ***/ EDSUFFIX $ 67 /*** enumeration district suffix ***/ SCSA 68-69 /*** Standard Consolidated Statistical Area ***/ URBAREA 70-73 /*** urbanized area ***/ CONDIST 74-75 /*** congressional district ***/ INDANV 76-78 /*** Indian reservation/Alaska native village ***/ MCDSEQNO 79-82 /*** MCD sequence number (11 states only) ***/ FILLER2 83-87 WARD 88-89 /*** ward ***/ SEA $ 90-91 /*** State Economic Area ***/ ESR 92-94 /*** Economic Sub-Region ***/ DOFFICE 95-98 /*** district office code ***/ SEQID 99-102 /*** 99-100: sequence of this record ***/ /*** 101-102: total records for each obs ***/ /*** the first 102 columns are repeated at the beginning of the second record segment of each logical record ***/ SMSASIZE 103 /*** SMSA size ***/ UATYPE 104 /*** Urbanized Area type ***/ UASIZE 105 /*** Urbanized Area size ***/ PLACDESC $ 106 /*** place description ***/ PLACESZE 107-108 /*** place size ***/ XCITY $ 109 /*** extended city indicator ***/ CBD $ 110 /*** Central Business District ***/ MCDCCDSZ 111 /*** Minor Civil Division/Census County Div. Size ***/ INDSUBR 112-115 /*** Indian subreservation ***/ FIPSPLAC 116-120 /*** FIPS place code (not on STF1) ***/ SFAR 121-122 /*** Standard Federal Administrative Region ***/ LONGITUD 123-129 /*** Longitude (not on STF1) ***/ LATITUDE 130-135 /*** Latitude (not on STF1) ***/ LANDAREA 136-144 .1 /*** land area (sq km to nearest 10th [1 decimal])*/ AREANAME $ 145-204 /*** area name ***/ SUPFLG01 205 /*** Suppression Flag 1 - total population ***/ SUPFLG02 206 /*** Suppression Flag 2 - White population ***/ SUPFLG03 207 /*** Suppression Flag 3 - Black population ***/ SUPFLG04 208 /*** Suppression Flag 4 - Amer Ind, Esk, Aleut ***/ SUPFLG05 209 /*** Suppression Flag 5 - Asian/Pacific Islander ***/ SUPFLG06 210 /*** Suppression Flag 6 - Spanish ***/ SUPFLG07 211 /*** Suppression Flag 7 - Spanish-White ***/ SUPFLG08 212 /*** Suppression Flag 8 - Spanish-Black ***/ SUPFLG09 213 /*** Suppression Flag 9 - year-round housing unit ***/ SUPFLG10 214 /*** Suppression Flag 10 - occupied housing unit ***/ SUPFLG11 215 /*** Suppression Flag 11 - White householder ***/ SUPFLG12 216 /*** Suppression Flag 12 - Black householder ***/ SUPFLG13 217 /*** Suppression Flag 13 - AmerInd,Esk,Aleut hhldr ***/ SUPFLG14 218 /*** Suppression Flag 14 - Asian/Pac.Islander hhldr ***/ SUPFLG15 219 /*** Suppression Flag 15 - other race householder ***/ SUPFLG16 220 /*** Suppression Flag 16 - owner/renter hous. unit ***/ SUPFLG17 221 /*** Suppression Flag 17 - owner occupied hous.unit ***/ SUPFLG18 222 /*** Suppression Flag 18 - renter occ. hous.unit ***/ SUPFLG19 223 /*** Suppression Flag 19 - Spanish householder ***/ SUPFLG20 224 /*** Suppression Flag 20 - Spanish-White hhldr ***/ SUPFLG21 225 /*** Suppression Flag 21 - Spanish-Black hhldr ***/ FILLER3 226-252 /*** TABLES BEGIN HERE ***/ @253 (T001_01 - T001_03 ) (9.) /* 253- 279 ( 253- 279) */ @280 T002 9. /* 280- 288 ( 280- 288) */ @289 T003 9. /* 289- 297 ( 289- 297) */ @298 (T004_01 - T004_03 ) (9.) /* 298- 324 ( 298- 324) */ @325 (T005_01 - T005_03 ) (9.) /* 325- 351 ( 325- 351) */ @352 (T006_01 - T006_02 ) (9.) /* 352- 369 ( 352- 369) */ @370 (T007_01 - T007_15 ) (9.) /* 370- 504 ( 370- 504) */ @505 (T008_01 - T008_05 ) (9.) /* 505- 549 ( 505- 549) */ @550 (T009_01 - T009_05 ) (9.) /* 550- 594 ( 550- 594) */ @595 (T010_01 - T010_52 ) (9.) /* 595-1062 ( 595-1062) */ @1063 (T011_01 - T011_03 ) (9.1) /* 1063-1089 (1063-1089) ** 1 decimal */ @1090 (T012_01 - T012_20 ) (9.) /* 1090-1269 (1090-1269) */ @1270 (T013_01 - T013_12 ) (9.) /* 1270-1377 (1270-1377) */ @1378 (T014_01 - T014_10 ) (9.) /* 1378-1467 (1378-1467) */ @1468 (T015_01 - T015_09 ) (9.) /* 1468-1548 (1468-1548) */ @1549 (T016_01 - T016_07 ) (9.) /* 1549-1611 (1549-1611) */ FILLER4 1612-1638 /******************************************************************* this is where segment 1 ends and segment 2 begins -- the following slash must remain in the INPUT statement even if all following variables are deleted *******************************************************************/ / /* this slash must remain!! */ /*******************************************************************/ /************* RECORD SEGMENT 2 ************************************ From this point on, the actual columns in which the data values are found begin again from '1', while the 'logical' columns continue on from 1639 to 3276. These column specifications, which coincide with those found in the STF1A code book, are shown in the comments to the right of each variable specification. ********************************************************************/ /******************************************************************* data in the first 102 columns of this segment duplicate the values in the first 102 columns of the first segment -- we do not re-read them here, so instead of beginning at virtual 1639, we begin after the first 102 columns, at virtual 1741 ********************************************************************/ @103 (T017_01 - T017_07 ) (9.) /* 103- 165 (1741-1803) */ @166 (T018_01 - T018_02 ) (9.) /* 166- 183 (1804-1821) */ @184 (T019_01 - T019_04 ) (9.) /* 184- 219 (1822-1857) */ @220 (T020_01 - T020_09 ) (9.) /* 220- 300 (1858-1938) */ @301 (T021_01 - T021_03 ) (9.) /* 301- 327 (1939-1965) */ @328 (T022_01 - T022_03 ) (9.) /* 328- 354 (1966-1992) */ @355 (T023_01 - T023_04 ) (9.) /* 355- 390 (1993-2028) */ @391 T024 9. /* 391- 399 (2029-2037) */ @400 (T025_01 - T025_04 ) (9.) /* 400- 435 (2038-2073) */ @436 (T026_01 - T026_02 ) (9.) /* 436- 453 (2074-2091) */ @454 (T027_01 - T027_10 ) (9.) /* 454- 543 (2092-2181) */ @544 (T028_01 - T028_06 ) (9.) /* 544- 597 (2182-2235) */ @598 (T029_01 - T029_04 ) (9.) /* 598- 633 (2236-2271) */ @634 (T030_01 - T030_06 ) (9.) /* 634- 687 (2272-2325) */ @688 T031 9.1 /* 688- 696 (2326-2334) 1 decimal */ @697 (T032_01 - T032_05 ) (9.) /* 697- 741 (2335-2379) */ @742 (T033_01 - T033_12 ) (9.) /* 742- 849 (2380-2487) */ @850 T034 9.2 /* 850- 858 (2488-2496) 2 decimal */ @859 T035 9.2 /* 859- 867 (2497-2505) 2 decimal */ @868 (T036_01 - T036_02 ) (9.) /* 868- 885 (2506-2523) */ @886 (T037_01 - T037_06 ) (9.) /* 886- 939 (2524-2577) */ @940 (T038_01 - T038_13 ) (9.) /* 940-1056 (2578-2694) */ @1057 T039 9. /* 1057-1065 (2695-2703) */ @1066 (T040_01 - T040_02 ) (9.) /* 1066-1085 (2704-2723) */ @1086 (T041_01 - T041_02 ) (9.) /* 1086-1103 (2724-2741) */ @1104 (T042_01 - T042_02 ) (9.) /* 1104-1123 (2742-2761) */ @1124 (T043_01 - T043_14 ) (9.) /* 1124-1249 (2762-2887) */ @1250 T044 9. /* 1250-1258 (2888-2896) */ @1259 (T045_01 - T045_02 )(10.) /* 1259-1278 (2897-2916) */ @1279 (T046_01 - T046_02 ) (9.) /* 1279-1296 (2917-2934) */ @1297 (T047_01 - T047_06 ) (9.) /* 1297-1350 (2935-2988) */ @1351 (T048_01 - T048_02 ) (9.) /* 1351-1368 (2989-3006) */ @1369 (T049_01 - T049_02 ) (9.) /* 1369-1386 (3007-3024) */ @1387 T050 9. /* 1387-1395 (3025-3033) */ @1396 (T051_01 - T051_02 ) (9.) /* 1396-1413 (3034-3051) */ @1414 T052 9. /* 1414-1422 (3052-3060) */ @1423 T053 9. /* 1423-1431 (3061-3069) */ @1432 T054 9. /* 1432-1440 (3070-3078) */ @1441 (T055_01 - T055_04 ) (9.) /* 1441-1476 (3079-3114) */ @1477 T056 9. /* 1477-1485 (3115-3123) */ @1486 (T057_01 - T057_07 ) (9.) /* 1486-1548 (3124-3186) */ @1549 T058 9. /* 1549-1557 (3187-3195) */ @1558 (T059_01 - T059_09 ) (9.) /* 1558-1638 (3196-3276) */ ; /*** the famous semicolon that ends the INPUT statement ***/ if tract2=' ' then tractnum=trim(left(tract4)); else tractnum=trim(left(tract4))||'.'||trim(left(tract2)); /*** TO SUBSET THE DATA ADD IF STATEMENTS HERE. EXAMPLE: ***/ /*** IF SUMRYLVL IN (4,11,14); ***/ /*******************************************************************/ PROC PRINT DATA=SAVER.CEN1A80 (OBS=30); RUN;