/*SHORT TITLE:  Select Population Variables for SMSAs  */

/* NOTE:  Data in suppressed data cells are recoded to system missing.
/* NOTE:  geoid is a variable used to match population and housing data.

set width 80.
set header=no.
set length=none.
get file="/eds/datasets/stf4a-70/stf4a-70p/data/stf4a-70p-ny-new.sav"
   / keep  st70 cnty70 tract trctsuf SMA record1
       T17_1 to T17_54   
       record2
       W17_1 to W17_54    
       record3
       B17_1 to B17_54
       B21_1 to B21_2 
       B25_1 to B25_15
       B26_1 to B26_5
       B42_1 to B42_20
       B58_1 to B58_42
       B75_1 to B75_15
       B82_1 to B82_8
       B83_1

select if (SMA ne '    ').
string geoid (A11).
compute geoid=concat(st70,cnty70,tract,trctsuf).

do if (T17_1 eq -1).
recode T17_1 to T17_54 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (W17_1 eq -1).
recode W17_1 to W17_54 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B17_1 eq -1).
recode B17_1 to B17_54 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B21_1 eq -1).
recode B21_1 to B21_2 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B25_1 eq -1).
recode B25_1 to B25_15 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B26_1 eq -1).
recode B26_1 to B26_5 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B42_1 eq -1).
recode B42_1 to B42_20 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B58_1 eq -1).
recode B58_1 to B58_42 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B75_1 eq -1).
recode B75_1 to B75_15 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B82_1 eq -1).
recode B82_1 to B82_8 (-1 = SYSMIS) (else = SYSMIS).
end if.

do if (B83_1 eq -1)
recode B83_1 (-1 = SYSMIS) (else = SYSMIS).
end if.

freq vars=SMA.
save outfile="ny-smsa.sav".