/*SHORT TITLE:  Program to read 1970 STF4A population file */

/* NOTE - !! This programs runs on re-formatted data!!
/* NOTE - The original data from ICPSR has each of the records broken
/*        up, i.e., records 1-4 were broken into 5 parts each and
/*        record 5 was broken into two parts.  See program join.pl
/*        for how they were put back together.
/* NOTE - Records 1-4 all have the same format.  Record 5 is different.
/* NOTE - Record 1 is for total population.
/*      - Record 2 is for whites.
/*      - Record 3 is for blacks.
/*      - Record 4 is for "Spanish Americans".
/*      - Record 5 has allocation data.
/* NOTE - Output file puts all 5 records into one long record.
/*        but drops the geography variables for records 2-5 since
/*        it is the same information.

/* NOTE - A case id was added to columns 1-5, so everything is moved 
/*        over 5 columns.

set width 80.

file handle in/ 

file type grouped record=rectype 6 case=id 1-5  file=in missing=nowarn.

record type 1.
data list /
  case1 record1 st70 st60 cntcnt minor place tract trctsuf busdist 
  SCA SMA urban ecoare trarea placed cityr ecosub cnty70 
  nesize necode plsize plcode symbol
  T2_1 to T2_2
  T4_1 to T4_2
  T5_1 to T5_2
  T6_1 to T6_7
  T7_1 to T7_3
  T8_1 to T8_12
  T9_1 to T9_12
  T12_1 to T12_4
  T13_1 to T13_4
  T14_1 to T14_2
  T15_1 to T15_2
  T16_1 to T16_4
  T17_1 to T17_54
  T18_1 to T18_12
  T19_1 to T19_9
  T20_1 to T20_12
  T21_1 to T21_2
  T22_1 to T22_66
  T23_1 to T23_26
  T24_1 to T24_4
  T25_1 to T25_15
  T26_1 to T26_5
  T27_1 to T27_7
  T28_1 to T28_10
  T29_1 to T29_7
  T30_1 to T30_6
  T31_1 to T31_4
  T32_1 to T32_3
  T33_1 to T33_6
  T34_1 to T34_8
  T35_1 to T35_26
  T36_1 to T36_9
  T37_1 to T37_7
  T38_1 to T38_15
  T39_1 to T39_9
  T40_1 to T40_2
  T41_1 to T41_8
  T42_1 to T42_20
  T43_1 to T43_4
  T44_1 to T44_12
  T45_1 to T45_5
  T46_1 to T46_6
  T47_1 to T47_2
  T48_1 to T48_3
  T49_1 to T49_3
  T50_1 to T50_4
  T51_1 to T51_7
  T52_1 to T52_14
  T53_1 to T53_8
  T54_1 to T54_18
  T55_1 to T55_16
  T56_1 to T56_8
  T57_1 to T57_12
  T58_1 to T58_42
  T59_1 to T59_27
  T60_1 to T60_5
  T61_1 to T61_5
  T62_1 to T62_82
  T63_1 to T63_4
  T64_1 to T64_21
  T65_1 to T65_28
  T66_1 to T66_7
  T67_1 to T67_28
  T68_1 to T68_26
  T69_1 to T69_28
  T70_1 to T70_20
  T71_1 to T71_4
  T72_1 to T72_4
  T73_1 to T73_6
  T74_1 to T74_4
  T75_1 to T75_15
  T76_1 to T76_15
  T77_1 to T77_28
  T78_1 to T78_98
  T79_1 to T79_39
  T80_1 to T80_12
  T81_1 to T81_12
  T82_1 to T82_8
  T84_1 to T84_12
  T85_1 to T85_8
  T86_1 to T86_2
  T87_1 to T87_6
  T88_1 to T88_2
  T89_1 to T89_4
  T90_1 to T90_2
  T92_1 to T92_2
  T93_1 to T93_4
  T94_1 to T94_3
  T95_1 to T95_3
  T96_1 to T96_4
  T97_1 to T97_2
  T98_1 to T98_16
  T99_1 to T99_4

record type 2.
data list /
  case2 record2 st702 st602 cntcnt2 minor2 place2 tract2 trctsuf2 busdist2 
  SCA2 SMA2 urban2 ecoare2 trarea2 placed2 cityr2 ecosub2 cnty702 
  nesize2 necode2 plsize2 plcode2 symbol2
  W2_1 to W2_2
  W4_1 to W4_2
  W5_1 to W5_2
  W6_1 to W6_7
  W7_1 to W7_3
  W8_1 to W8_12
  W9_1 to W9_12
  W12_1 to W12_4
  W13_1 to W13_4
  W14_1 to W14_2
  W15_1 to W15_2
  W16_1 to W16_4
  W17_1 to W17_54
  W18_1 to W18_12
  W19_1 to W19_9
  W20_1 to W20_12
  W21_1 to W21_2
  W22_1 to W22_66
  W23_1 to W23_26
  W24_1 to W24_4
  W25_1 to W25_15
  W26_1 to W26_5
  W27_1 to W27_7
  W28_1 to W28_10
  W29_1 to W29_7
  W30_1 to W30_6
  W31_1 to W31_4
  W32_1 to W32_3
  W33_1 to W33_6
  W34_1 to W34_8
  W35_1 to W35_26
  W36_1 to W36_9
  W37_1 to W37_7
  W38_1 to W38_15
  W39_1 to W39_9
  W40_1 to W40_2
  W41_1 to W41_8
  W42_1 to W42_20
  W43_1 to W43_4
  W44_1 to W44_12
  W45_1 to W45_5
  W46_1 to W46_6
  W47_1 to W47_2
  W48_1 to W48_3
  W49_1 to W49_3
  W50_1 to W50_4
  W51_1 to W51_7
  W52_1 to W52_14
  W53_1 to W53_8
  W54_1 to W54_18
  W55_1 to W55_16
  W56_1 to W56_8
  W57_1 to W57_12
  W58_1 to W58_42
  W59_1 to W59_27
  W60_1 to W60_5
  W61_1 to W61_5
  W62_1 to W62_82
  W63_1 to W63_4
  W64_1 to W64_21
  W65_1 to W65_28
  W66_1 to W66_7
  W67_1 to W67_28
  W68_1 to W68_26
  W69_1 to W69_28
  W70_1 to W70_20
  W71_1 to W71_4
  W72_1 to W72_4
  W73_1 to W73_6
  W74_1 to W74_4
  W75_1 to W75_15
  W76_1 to W76_15
  W77_1 to W77_28
  W78_1 to W78_98
  W79_1 to W79_39
  W80_1 to W80_12
  W81_1 to W81_12
  W82_1 to W82_8
  W84_1 to W84_12
  W85_1 to W85_8
  W86_1 to W86_2
  W87_1 to W87_6
  W88_1 to W88_2
  W89_1 to W89_4
  W90_1 to W90_2
  W92_1 to W92_2
  W93_1 to W93_4
  W94_1 to W94_3
  W95_1 to W95_3
  W96_1 to W96_4
  W97_1 to W97_2
  W98_1 to W98_16
  W99_1 to W99_4

record type 3.
data list /
  case3 record3 st703 st603 cntcnt3 minor3 place3 tract3 trctsuf3 busdist3 
  SCA3 SMA3 urban3 ecoare3 trarea3 placed3 cityr3 ecosub3 cnty703 
  nesize3 necode3 plsize3 plcode3 symbol3
  B2_1 to B2_2
  B4_1 to B4_2
  B5_1 to B5_2
  B6_1 to B6_7
  B7_1 to B7_3
  B8_1 to B8_12
  B9_1 to B9_12
  B12_1 to B12_4
  B13_1 to B13_4
  B14_1 to B14_2
  B15_1 to B15_2
  B16_1 to B16_4
  B17_1 to B17_54
  B18_1 to B18_12
  B19_1 to B19_9
  B20_1 to B20_12
  B21_1 to B21_2
  B22_1 to B22_66
  B23_1 to B23_26
  B24_1 to B24_4
  B25_1 to B25_15
  B26_1 to B26_5
  B27_1 to B27_7
  B28_1 to B28_10
  B29_1 to B29_7
  B30_1 to B30_6
  B31_1 to B31_4
  B32_1 to B32_3
  B33_1 to B33_6
  B34_1 to B34_8
  B35_1 to B35_26
  B36_1 to B36_9
  B37_1 to B37_7
  B38_1 to B38_15
  B39_1 to B39_9
  B40_1 to B40_2
  B41_1 to B41_8
  B42_1 to B42_20
  B43_1 to B43_4
  B44_1 to B44_12
  B45_1 to B45_5
  B46_1 to B46_6
  B47_1 to B47_2
  B48_1 to B48_3
  B49_1 to B49_3
  B50_1 to B50_4
  B51_1 to B51_7
  B52_1 to B52_14
  B53_1 to B53_8
  B54_1 to B54_18
  B55_1 to B55_16
  B56_1 to B56_8
  B57_1 to B57_12
  B58_1 to B58_42
  B59_1 to B59_27
  B60_1 to B60_5
  B61_1 to B61_5
  B62_1 to B62_82
  B63_1 to B63_4
  B64_1 to B64_21
  B65_1 to B65_28
  B66_1 to B66_7
  B67_1 to B67_28
  B68_1 to B68_26
  B69_1 to B69_28
  B70_1 to B70_20
  B71_1 to B71_4
  B72_1 to B72_4
  B73_1 to B73_6
  B74_1 to B74_4
  B75_1 to B75_15
  B76_1 to B76_15
  B77_1 to B77_28
  B78_1 to B78_98
  B79_1 to B79_39
  B80_1 to B80_12
  B81_1 to B81_12
  B82_1 to B82_8
  B84_1 to B84_12
  B85_1 to B85_8
  B86_1 to B86_2
  B87_1 to B87_6
  B88_1 to B88_2
  B89_1 to B89_4
  B90_1 to B90_2
  B92_1 to B92_2
  B93_1 to B93_4
  B94_1 to B94_3
  B95_1 to B95_3
  B96_1 to B96_4
  B97_1 to B97_2
  B98_1 to B98_16
  B99_1 to B99_4

record type 4.
data list /
  case4 record4 st704 st604 cntcnt4 minor4 place4 tract4 trctsuf4 busdist4 
  SCA4 SMA4 urban4 ecoare4 trarea4 placed4 cityr4 ecosub4 cnty704 
  nesize4 necode4 plsize4 plcode4 symbol4
  H2_1 to H2_2
  H4_1 to H4_2
  H5_1 to H5_2
  H6_1 to H6_7
  H7_1 to H7_3
  H8_1 to H8_12
  H9_1 to H9_12
  H12_1 to H12_4
  H13_1 to H13_4
  H14_1 to H14_2
  H15_1 to H15_2
  H16_1 to H16_4
  H17_1 to H17_54
  H18_1 to H18_12
  H19_1 to H19_9
  H20_1 to H20_12
  H21_1 to H21_2
  H22_1 to H22_66
  H23_1 to H23_26
  H24_1 to H24_4
  H25_1 to H25_15
  H26_1 to H26_5
  H27_1 to H27_7
  H28_1 to H28_10
  H29_1 to H29_7
  H30_1 to H30_6
  H31_1 to H31_4
  H32_1 to H32_3
  H33_1 to H33_6
  H34_1 to H34_8
  H35_1 to H35_26
  H36_1 to H36_9
  H37_1 to H37_7
  H38_1 to H38_15
  H39_1 to H39_9
  H40_1 to H40_2
  H41_1 to H41_8
  H42_1 to H42_20
  H43_1 to H43_4
  H44_1 to H44_12
  H45_1 to H45_5
  H46_1 to H46_6
  H47_1 to H47_2
  H48_1 to H48_3
  H49_1 to H49_3
  H50_1 to H50_4
  H51_1 to H51_7
  H52_1 to H52_14
  H53_1 to H53_8
  H54_1 to H54_18
  H55_1 to H55_16
  H56_1 to H56_8
  H57_1 to H57_12
  H58_1 to H58_42
  H59_1 to H59_27
  H60_1 to H60_5
  H61_1 to H61_5
  H62_1 to H62_82
  H63_1 to H63_4
  H64_1 to H64_21
  H65_1 to H65_28
  H66_1 to H66_7
  H67_1 to H67_28
  H68_1 to H68_26
  H69_1 to H69_28
  H70_1 to H70_20
  H71_1 to H71_4
  H72_1 to H72_4
  H73_1 to H73_6
  H74_1 to H74_4
  H75_1 to H75_15
  H76_1 to H76_15
  H77_1 to H77_28
  H78_1 to H78_98
  H79_1 to H79_39
  H80_1 to H80_12
  H81_1 to H81_12
  H82_1 to H82_8
  H84_1 to H84_12
  H85_1 to H85_8
  H86_1 to H86_2
  H87_1 to H87_6
  H88_1 to H88_2
  H89_1 to H89_4
  H90_1 to H90_2
  H92_1 to H92_2
  H93_1 to H93_4
  H94_1 to H94_3
  H95_1 to H95_3
  H96_1 to H96_4
  H97_1 to H97_2
  H98_1 to H98_16
  H99_1 to H99_4

record type 5.
data list/
  case5 record5 st705 st605 cntcnt5 minor5 place5 tract5 trctsuf5 busdist5 
  SCA5 SMA5 urban5 ecoare5 trarea5 placed5 cityr5 ecosub5 cnty705 
  nesize5 necode5 plsize5 plcode5 symbol5
  T101_1 to T101_60
  T103_1 to T103_2
  T104_1 to T104_2
  T105_1 to T105_3
  T106_1 to T106_12
  T107_1 to T107_2
  T108_1 to T108_2
  T109_1 to T109_8
  T110_1 to T110_5
  T111_1 to T111_6
  T112_1 to T112_14
  T113_1 to T113_5
  T114_1 to T114_10
  T115_1 to T115_4
  T116_1 to T116_12
  T117_1 to T117_14
  T118_1 to T118_7
  T119_1 to T119_4
  T120_1 to T120_28
  T121_1 to T121_30
  T122_1 to T122_20
  T123_1 to T123_10
end file type.

Variable Labels
  st70     "1970 State Code"
  st60     "1960 State Code"
  cntcnt   "Central County Code"
  minor    "Minor Civil or Census County Division"
  place    "Place"
  tract    "Tract(basic)"
  trctsuf  "Tract(suffix)"
  busdist  "Central Business District"
  SCA      "Standard Consolidated Area"
  SMA      "Standard Metro Stat Area"
  urban    "Urbanized Area"
  ecoare   "State Economic Area"
  trarea   "Tracted Area"
  placed   "Place Description"
  cityr    "City with Rural Territory"
  ecosub   "Econommic Subregion"
  cnty70   "1970 Tabulation County"
  nesize   "New England Town Size Code"
  necode   "New England Town Code"
  plsize   "Place Size"
  plcode   "Publication Code"
  symbol   "Symbol"

freq vars=rectype.
* select if (cnty701 eq '061').
* freq vars=rectype   B42_1 to B42_20  W42_1 to W42_20 T42_1 to T42_20.
* B58_1 to B58_42 B75_1 to B75_15 B82_1 to B82_8.

save outfile="/eds/datasets/stf4a-70/stf4a-70p/data/stf4a-70p-ny-new.sav"
   / drop=rectype case1 case2 case3 case4 case5
   st702 to symbol2  st703 to symbol3  st704 to symbol4  st704 to symbol4