x cd /pub/data/stf901x2/Tools; %let pgm=sf1990x; filename pgm "&pgm..sas"; *--Coded by Shiva Kumar, OSEDA, circa June, 2001. Under contract with Mo Census Data Center. Specs by J.Blodgett, OSEDA. Creates a standard extract file based on a full 1990 stf1 data set (filetype stf901). We already had a stf901x filetype, but this one is somewhat different. It is being created specifically to serve as input data for the dp1_2kt standard trend report product. In this run we convert data for the state of Missouri, down to BG level, leaving the geography as it was - i.e. 1990. --*; %libname(stf901); libname stf901x2 '/pub/data/stf901x2'; *%let state=29; %macro cnvt(set); data stf901x2.&set; *--this step adapted from the stf901x conversion code and creates vars consistent with stf901x filetype-; length slvl $3 geocode $16 default=4; set stf901.&set (rename=(slvl=sumlev)); where sumlev in ('040' '050' '060' '155' '160' '500'); *--the following select group assigns the variable geocode based on values of slvl. note that it is critical that this code be consistent with that used in stf801x conversion so that we can match the data sets on geocode and slvl.; select (sumlev); when('040') do; if geocomp='00'; *<---omit other special geographic components; geocode=state; end; when('050') do; geocode=county; end; when('060') do; geocode=county||'-'||cousubfp; end; when('155') do; geocode=county||'-'||placefp; end; when('160') do; geocode=state||'-'||placefp; end; when('140') do; geocode=county||'-'||tract; end; when('150') do; geocode=county||'-'||tract||'-'||bg; end; when('100') do; geocode=substr(county,3,3)||'-'||tract||'-'||blk; end; when('500') geocode=state||'-'||cd; otherwise do; _nother+1; *--(not needed since we use a keep):drop _nother; if _nother le 5 then put _n_= sumlev= areaname= ' ***not processed'; delete; end; end; %macro agegroup(sex= ,age1= , age2= ); sum=0; do irace=1 to 5; do jage= &age1 to &age2; sum+ p12{irace,&sex,jage}; end; end; %mend agegroup; *--following arrays, retain are for median macro (medage var)--; array intvals p11i1-p11i31; array intsize is1-is31; retain is1 1 is2 2 is3 2 is4 1 is5 1 is6 3 is7 2 is8 2 is9 1 is10 1 is11 1 is12 1 is13 1 is14 1 is15 1 is16 1 is17 3 is18 5 is19 5 is20 5 is21 5 is22 5 is23 5 is24 5 is25 2 is26 3 is27 5 is28 5 is29 5 is30 5 is31 10; *--additional variables can be added here. must use a keep stmt--; length default=4; *---Attrib statement(s) generated by genattr macro---; Attrib TotPop length= 5 format=comma. label='Total Persons' Male length= 5 format=comma. label='Male' pct_Male length=3 format=5.1 label='% Male' Female length= 5 format=comma. label='Female' pct_Female length=3 format=5.1 label='% Female' ; Attrib Age0_4 length= 5 format=comma. label='Under 5 Yrs' pct_Age0_4 length=3 format=5.1 label='% Under 5 Yrs' Age5_9 length= 5 format=comma. label='5 to 9' pct_Age5_9 length=3 format=5.1 label='% 5 to 9' Age10_14 length= 5 format=comma. label='10 to 14' pct_Age10_14 length=3 format=5.1 label='% 10 to 14' Age15_19 length= 5 format=comma. label='15 to 19' pct_Age15_19 length=3 format=5.1 label='% 15 to 19' Age15_17 length= 5 format=comma. label='15 to 17' pct_Age15_17 length=3 format=5.1 label='% 15 to 17' Age18_19 length= 5 format=comma. label='18 to 19' pct_Age18_19 length=3 format=5.1 label='% 18 to 19' Age18_24 length= 5 format=comma. label='18 to 24' pct_Age18_24 length=3 format=5.1 label='% 18 to 24' Age20_24 length= 5 format=comma. label='20 to 24' pct_Age20_24 length=3 format=5.1 label='% 20 to 24' Age25_44 length= 5 format=comma. label='25 to 44' pct_Age25_44 length=3 format=5.1 label='% 25 to 44' Age45_64 length= 5 format=comma. label='45 to 64' pct_Age45_64 length=3 format=5.1 label='% 45 to 64' Age25_34 length= 5 format=comma. label='25 to 34' pct_Age25_34 length=3 format=5.1 label='% 25 to 34' Age35_44 length= 5 format=comma. label='35 to 44' pct_Age35_44 length=3 format=5.1 label='% 35 to 44' Age45_54 length= 5 format=comma. label='45 to 54' pct_Age45_54 length=3 format=5.1 label='% 45 to 54' Age55_59 length= 5 format=comma. label='55 to 59' pct_Age55_59 length=3 format=5.1 label='% 55 to 59' Age60_64 length= 5 format=comma. label='60 to 64' pct_Age60_64 length=3 format=5.1 label='% 60 to 64' ; Attrib Age65_74 length= 5 format=comma. label='65 to 74' pct_Age65_74 length=3 format=5.1 label='% 65 to 74' Age75_84 length= 5 format=comma. label='75 to 84' pct_Age75_84 length=3 format=5.1 label='% 75 to 84' Over85 length= 5 format=comma. label='Over 85' pct_Over85 length=3 format=5.1 label='% Over 85' Median_Age length= 5 format=5.1 label='Median age' age17_down length= 5 format=comma. label='17 and Under' pct_age17_down length=3 format=5.1 label='% 17 and Under' Over18 length= 5 format=comma. label='Over 18' pct_Over18 length=3 format=5.1 label='% Over 18' Over18_Male length= 5 format=comma. label='Over 18 Male' pct_Over18_Male length=3 format=5.1 label='% Over 18 Male' Over18_Female length= 5 format=comma. label='Over 18 Female' pct_Over18_Female length=3 format=5.1 label='% Over 18 Female' Over21 length= 5 format=comma. label='Over 21' pct_Over21 length=3 format=5.1 label='% Over 21' Over62 length= 5 format=comma. label='Over 62' pct_Over62 length=3 format=5.1 label='% Over 62' Over65 length= 5 format=comma. label='Over 65' pct_Over65 length=3 format=5.1 label='% Over 65' Over65_Male length= 5 format=comma. label='Over 65 Male' ; Attrib pct_Over65_Male length=3 format=5.1 label='% Over 65 Male' Over65_Female length= 5 format=comma. label='Over 65 Female' pct_Over65_Female length=3 format=5.1 label='% Over 65 Female' White1 length= 5 format=comma. label='White Alone' pct_White1 length=3 format=5.1 label='% White Alone' Black1 length= 5 format=comma. label='Black or African American Alone' pct_Black1 length=3 format=5.1 label='% Black or African American Alone' Indian length= 5 format=comma. label='American Indian or Alaska Native Alone' pct_Indian length=3 format=5.1 label='% American Indian or Alaska Native Alone' Asian1 length= 5 format=comma. label='Asian Alone' pct_Asian1 length=3 format=5.1 label='% Asian Alone' Asian_Indian length= 5 format=comma. label='Asian Indian' pct_Asian_Indian length=3 format=5.1 label='% Asian Indian' Chinese length= 5 format=comma. label='Chinese' pct_Chinese length=3 format=5.1 label='% Chinese' Filipino length= 5 format=comma. label='Filipino' pct_Filipino length=3 format=5.1 label='% Filipino' Japanese length= 5 format=comma. label='Japanese' ; Attrib pct_Japanese length=3 format=5.1 label='% Japanese' Korean length= 5 format=comma. label='Korean' pct_Korean length=3 format=5.1 label='% Korean' Vietnamese length= 5 format=comma. label='Vietnamese' pct_Vietnamese length=3 format=5.1 label='% Vietnamese' Other_Asian length= 5 format=comma. label='Other Asian' pct_Other_Asian length=3 format=5.1 label='% Other Asian' HawnPI1 length= 5 format=comma. label='Hawaiian and Other Pac Islndr Alone' pct_HawnPI1 length=3 format=5.1 label='% Hawaiian and Other Pac Islndr Alone' Hawaiian length= 5 format=comma. label='Native Hawaiian' pct_Hawaiian length=3 format=5.1 label='% Native Hawaiian' Guam_or_Cham length= 5 format=comma. label='Guamanian or Chamorro' pct_Guam_or_Cham length=3 format=5.1 label='% Guamanian or Chamorro' Samoan length= 5 format=comma. label='Samoan' pct_Samoan length=3 format=5.1 label='% Samoan' Other_Pac_Islander length= 5 format=comma. label='Other Pacific Islander Alone' pct_Other_Pac_Islander length=3 format=5.1 label='% Other Pacific Islander Alone' Other1 length= 5 format=comma. label='Some other race Alone' pct_Other1 length=3 format=5.1 label='% Some other race Alone' ; Attrib HispPop length= 5 format=comma. label='Total Hispanic or Latino (any Race)' pct_HispPop length=3 format=5.1 label='% Total Hispanic or Latino (any Race)' Mexican length= 5 format=comma. label='Mexican' pct_Mexican length=3 format=5.1 label='% Mexican' Puerto_Rican length= 5 format=comma. label='Puerto Rican' pct_Puerto_Rican length=3 format=5.1 label='% Puerto Rican' Cuban length= 5 format=comma. label='Cuban' ; Attrib pct_Cuban length=3 format=5.1 label='% Cuban' Other_Hisp length= 5 format=comma. label='Other Hispanic or Latino' pct_Other_Hisp length=3 format=5.1 label='% Other Hispanic or Latino' Non_Hispanic length= 5 format=comma. label='Not Hispanic or Latino' pct_Non_Hispanic length=3 format=5.1 label='% Not Hispanic or Latino' White_Non_Hispanic length= 5 format=comma. label='White Alone Non Hispanic' pct_White_Non_Hispanic length=3 format=5.1 label='% White Alone Non Hispanic' HHPop length= 5 format=comma. label='Persons In households' pct_HHPop length=3 format=5.1 label='% Persons In households' Householder length= 5 format=comma. label='Householder' pct_Householder length=3 format=5.1 label='% Householder' Spouse length= 5 format=comma. label='Spouse' pct_Spouse length=3 format=5.1 label='% Spouse' Child length= 5 format=comma. label='Child' pct_Child length=3 format=5.1 label='% Child' OwnChild_Under18 length= 5 format=comma. label='Own child under 18' pct_OwnChild_Under18 length=3 format=5.1 label='% Own child under 18' Other_relatives length= 5 format=comma. label='Other Relatives' pct_Other_relatives length=3 format=5.1 label='% Other Relatives' Other_Under18 length= 5 format=comma. label='Other Relatives under 18' ; Attrib pct_Other_Under18 length=3 format=5.1 label='% Other Relatives under 18' Nonrelatives length= 5 format=comma. label='Nonrelatives' pct_Nonrelatives length=3 format=5.1 label='% Nonrelatives' Unmarried_partner length= 5 format=comma. label='Unmarried Partner' pct_Unmarried_partner length=3 format=5.1 label='% Unmarried Partner' GQPop length= 5 format=comma. label='Group Quarters' pct_GQPop length=3 format=5.1 label='% Group Quarters' Institution_Pop length= 5 format=comma. label='Institutionalized Pop' pct_Institution_Pop length=3 format=5.1 label='% Institutionalized Pop' NonInstitution_Pop length= 5 format=comma. label='Non Institutionalized GQ Pop' pct_NonInstitution_Pop length=3 format=5.1 label='% Non Institutionalized GQ Pop' TotHHs length= 5 format=comma. label='Total Households' Families length= 5 format=comma. label='Family Households' pct_Families length=3 format=5.1 label='% Family Households' Fam_ChildUnder18 length= 5 format=comma. label='Families with own children < 18' pct_Fam_ChildUnder18 length=3 format=5.1 label='% Families with own children < 18' Married_Couple length= 5 format=comma. label='Married Couple Family' pct_Married_Couple length=3 format=5.1 label='% Married Couple Family' MarrCouple_ChildUnder18 length= 5 format=comma. label='Married Couple Own Children < 18' pct_MarrCouple_ChildUnder18 length=3 format=5.1 label='% Married Couple Own Children < 18' ; Attrib FemaleHouseholder length= 5 format=comma. label='Female Householder No Husband' pct_FemaleHouseholder length=3 format=5.1 label='% Female Householder No Husband' Fem_ChildUnder18 length= 5 format=comma. label='Female Householder With Own Child < 18' pct_Fem_ChildUnder18 length=3 format=5.1 label='% Female Householder With Own Child < 18' NonFamily_Households length= 5 format=comma. label='Non Family Households' pct_NonFamily_Households length=3 format=5.1 label='% Non Family Households' LivingAlone length= 5 format=comma. label='Persons Living Alone' pct_LivingAlone length=3 format=5.1 label='% Persons Living Alone' Householder_Over65 length= 5 format=comma. label='Householder 65+' pct_Householder_Over65 length=3 format=5.1 label='% Householder 65+' House_IndvUnder18 length= 5 format=comma. label='Households w. Individuals Under 18' pct_House_IndvUnder18 length=3 format=5.1 label='% Households w. Individuals Under 18' House_IndvOver65 length= 5 format=comma. label='Households w. Individuals Over 65' pct_House_IndvOver65 length=3 format=5.1 label='% Households w. Individuals Over 65' Avg_HouseSize length= 5 label='Avg Household Size' Avg_FamSize length= 5 label='Avg Family Size' Tot_Units length= 5 format=comma. label='Total Housing Units' Occupied_Units length= 5 format=comma. label='Occupied Housing Units' pct_Occupied_Units length=3 format=5.1 label='% Occupied Housing Units' Vacant_Units length= 5 format=comma. label='Vacant Housing Units' ; Attrib gqpop length= 5 format=comma. label ='Population in Group quarters' pct_gqpop length=3 format=5.1 label='% Population in Group quarters' Institution_pop length= 5 format=comma. label='Instituionalized population' pct_Institution_pop length=3 format=5.1 label='% Instituionalized population' correction_institutions length= 5 format=comma. label='Correctional Instituions' pct_correction_institutions length=3 format=5.1 label='% Correctional Instituions' Nursing_homes length= 5 format=comma. label='Nursing Homes' pct_Nursing_homes length=3 format=5.1 label='% Nursing Homes' NonInstitution_pop length= 5 format=comma. label='Noninstituionalized population' pct_NonInstitution_pop length=3 format=5.1 label='% Noninstituionalized population' military_quarters length= 5 format=comma. label='Military Quarters' pct_military_quarters length=3 format=5.1 label='% Military Quarters' College_dormitories length= 5 format=comma. label='College dormitories (includes college quarters off campus)' pct_College_dormitories length=3 format=5.1 label='% College dormitories' other_noninstitution_gp length= 5 format=comma. label='Other noninstituional group quarters' pct_other_noninstitution_gp length=3 format=5.1 label='% Other noninstituional group quarters' ; Attrib pct_Vacant_Units length=3 format=5.1 label='% Vacant Housing Units' vacantforrent length= 5 format=comma. label='Units - Vacant for Rent' pct_vacantforrent length=3 format=5.1 label='% Units - Vacant for Rent' vacantforsale length= 5 format=comma. label='Units - Vacant for Sale' pct_vacantforsale length=3 format=5.1 label='% Units - Vacant for Sale' Seas_Rec_Use length= 5 format=comma. label='Units - Seasonal, Rec or Occasional Use' pct_Seas_Rec_Use length=3 format=5.1 label='% Units - Seasonal, Rec or Occasional Use' OwnerVacRate length= 5 label='Owner Unit Vacancy Rate' RentalVacRate length= 5 label='Rental Unit Vacancy Rate' Occupied_Units length= 5 format=comma. label='Occupied Housing Units' Owner_Occupied length= 5 format=comma. label='Owner-occupied Units' pct_Owner_Occupied length=3 format=5.1 label='% Owner-occupied Units' Renter_Occupied length= 5 format=comma. label='Renter-occupied Units' pct_Renter_Occupied length=3 format=5.1 label='% Renter-occupied Units' AvgSize_Owner length= 5 label='Avg Size of Owner-occupied Units' AvgSize_Renter length= 5 label='Avg Size of Renter-occupied Units' ; *-- Total Population Trends --; totpop=p1i1; if areasqmi gt 0 then poppsqmi=p1i1/areasqmi; format poppsqmi 7.1; label poppsqmi='persons per square mile'; male=p1i1-p5i2; female=p5i2; %macro percent(compvar= , basevar= ); if &basevar gt 0 then pct_&compvar=(&compvar/&basevar)*100; %mend percent; %percent(compvar=male,basevar=totpop); %percent(compvar=female,basevar=totpop); married=sum(of p14i2 p14i7); *--now married, except separated-; notmarri=p14i1+p14i3+p14i4+p14i5+p14i6+p14i8+p14i9+p14i10; infamily=p17i1; *--persons in family households-; groupqtr=sum(of p15i11 p15i12); rural=p4i3; if p4i4=p1i1 then rural=.; *label totpop='Total Persons' groupqtr='persons in group quarters' married='over 15 married not sep' notmarri='over 15 not married or sep' infamily='persons in families'; *--2. Age--; age0_4 = sum(of p11i1-p11i3); age5_9 = sum(of p11i4-p11i6); age10_14=p11i7 + p11i8 + p11i9 ; age15_17=sum(of p11i10-p11i12); age18_19=sum(of p11i13-p11i14); age15_19=sum(of p11i10-p11i14); age18_24=sum(of p11i13-p11i17); age20_24=sum(of p11i15-p11i17); age25_34=p11i18 + p11i19; age35_44=p11i20+p11i21; age45_54=p11i22 + p11i23; age55_59=p11i24; age60_64=p11i25 + p11i26; age65_74=p11i27 + p11i28; age75_84=p11i29 + p11i30; age25_44=sum(of p11i18-p11i21); age45_64=sum(of p11i22-p11i26); %median(intsize=intsize,intvals=intvals,mdn=medage) median_age=medage; age17_down=sum(of p11i1- p11i12); over21=sum(of p11i16 - p11i31); over62=sum(of p11i26 - p11i31); over65=sum(of p11i27 - p11i31); over18=sum(of p11i13-p11i31); over85=p11i31; array p12{5,2,31} p12i1-p12i310; %agegroup(sex=1,age1=13,age2=31); Over18_Male=sum; %agegroup(sex=2,age1=13,age2=31); Over18_Female=sum; %agegroup(sex=1,age1=27,age2=31); Over65_Male=sum; %agegroup(sex=2,age1=27,age2=31); Over65_Female=sum; %percent(compvar=age0_4,basevar=totpop); %percent(compvar=age5_9 ,basevar=totpop); %percent(compvar=age10_14,basevar=totpop); %percent(compvar=age15_19,basevar=totpop); %percent(compvar=age15_17,basevar=totpop); %percent(compvar=age18_19,basevar=totpop); %percent(compvar=age20_24,basevar=totpop); %percent(compvar=age25_34,basevar=totpop); %percent(compvar=age35_44,basevar=totpop); %percent(compvar=age45_54,basevar=totpop); %percent(compvar=age55_59,basevar=totpop); %percent(compvar=age60_64,basevar=totpop); %percent(compvar=age65_74,basevar=totpop); %percent(compvar=age75_84,basevar=totpop); %percent(compvar=over85,basevar=totpop); %percent(compvar=median_age,basevar=totpop); %percent(compvar=age17_down,basevar=totpop); %percent(compvar=over18,basevar=totpop); %percent(compvar=over18_male,basevar=totpop); %percent(compvar=over18_female,basevar=totpop); %percent(compvar=over21,basevar=totpop); %percent(compvar=age18_24,basevar=totpop); %percent(compvar=age25_44,basevar=totpop); %percent(compvar=age45_64,basevar=totpop); %percent(compvar=over62,basevar=totpop); %percent(compvar=over65,basevar=totpop); %percent(compvar=over65_male,basevar=totpop); %percent(compvar=over65_female,basevar=totpop); *--3. Race -*; white1=p6i1; black1=p6i2; indian=p6i3; asian1=sum(of p7i6 - p7i16)+ sum(of p7i17-p7i24); asian_indian=p7i9; chinese=p7i6; filipino=p7i7; japanese=p7i8; korean=p7i10; vietnamese=p7i11; other_asian=sum(of p7i12 - p7i16); hawnpi1=sum(of p7i17-p7i24); hawaiian=p7i17; guam_or_cham=p7i21; samoan=p7i18; other_pac_islander=p7i19+p7i20+p7i22+p7i23+p7i24; other1=p7i25; %percent(compvar=white1,basevar=totpop); %percent(compvar=black1,basevar=totpop); %percent(compvar=indian,basevar=totpop); %percent(compvar=asian1,basevar=totpop); %percent(compvar=asian_indian,basevar=totpop); %percent(compvar=chinese,basevar=totpop); %percent(compvar=filipino,basevar=totpop); %percent(compvar=japanese,basevar=totpop); %percent(compvar=korean,basevar=totpop); %percent(compvar=vietnamese,basevar=totpop); %percent(compvar=other_asian,basevar=totpop); %percent(compvar=hawnpi1,basevar=totpop); %percent(compvar=hawaiian,basevar=totpop); %percent(compvar=guam_or_cham,basevar=totpop); %percent(compvar=samoan,basevar=totpop); %percent(compvar=other_pac_islander,basevar=totpop); %percent(compvar=other1,basevar=totpop); *---4. Hispanic or Latino and Race --; hisppop=p8i1; mexican=p9i2; puerto_rican=p9i3; cuban=p9i4; other_hisp=p9i5; non_hispanic=p1i1-p8i1; white_non_hispanic=p10i1; %percent(compvar=hisppop,basevar=totpop); %percent(compvar=mexican,basevar=totpop); %percent(compvar=puerto_rican,basevar=totpop); %percent(compvar=cuban,basevar=totpop); %percent(compvar=other_hisp,basevar=totpop); %percent(compvar=non_hispanic,basevar=totpop); %percent(compvar=white_non_hispanic,basevar=totpop); *-- 5. Relationship of Persons in Households --; hhpop=sum (of p15i1 - p15i10); householder=p15i1+p15i8+p15i9; spouse=p15i2; child=sum (of p15i3 - p15i4); ownchild_under18=sum (of p21i2 - p21i4); other_relatives=p15i6+p15i5; other_under18=p21i5; nonrelatives=p15i7+p15i10; %percent(compvar=hhpop,basevar=totpop); %percent(compvar=householder,basevar=totpop); %percent(compvar=spouse,basevar=totpop); %percent(compvar=child,basevar=totpop); %percent(compvar=ownchild_under18,basevar=totpop); %percent(compvar=other_relatives,basevar=totpop); %percent(compvar=other_under18,basevar=totpop); %percent(compvar=nonrelatives,basevar=totpop); %percent(compvar=unmarried_partner,basevar=totpop); *--6. Households by Type --; tothhs=p3i1; families=p2i1; fam_childunder18=p18i1+p18i2+p18i3; married_couple=p16i3+p16i4; marrcouple_childunder18=p18i1; femalehouseholder=p16i7+p16i8; *-female headed family non-mc hhs; fem_childunder18=p18i3; *--female headed hh no husband w kids; nonfamily_households=sum(of p15i8-p15i9); livingalone=p15i8; house_indvunder18=sum (of p18i1 - p18i5); *-- households with individuals under 18 yrs; house_indvover65=sum (of p25i1 - p25i3); *-- household with individuals 65 years and over; householder_over65=p23i5+p23i7; if p3i1 gt 0 then avg_housesize=(p1i1-p15i11-p15i12)/p3i1; format avg_housesize 4.2; avg_famsize=p17ai1; format avg_famsize 4.2; %percent(compvar=tothhs,basevar=tothhs); %percent(compvar=families,basevar=tothhs); %percent(compvar=fam_childunder18,basevar=tothhs); %percent(compvar=married_couple,basevar=tothhs); %percent(compvar=marrcouple_childunder18,basevar=tothhs); %percent(compvar=femalehouseholder,basevar=tothhs); %percent(compvar=fem_childunder18,basevar=tothhs); %percent(compvar=nonfamily_households,basevar=tothhs); %percent(compvar=livingalone,basevar=tothhs); %percent(compvar=householder_over65,basevar=tothhs); %percent(compvar=house_indvunder18,basevar=tothhs); %percent(compvar=house_indvover65,basevar=tothhs); *---7. Group quarters------------------; gqpop=p15i11+p15i12; institution_pop=p15i11; correction_institutions=p28i1; Nursing_homes=p28i2; noninstitution_pop=p15i12; college_dormitories=p28i6; military_quarters=p28i7; other_noninstitution_gp=p28i10; %percent(compvar=gqpop,basevar=totpop); %percent(compvar=Institution_pop,basevar=totpop); %percent(compvar= correction_institutions,basevar=totpop); %percent(compvar=Nursing_homes,basevar=totpop); %percent(compvar=Other_institutions,basevar=totpop); %percent(compvar=NonInstitution_pop,basevar=totpop); %percent(compvar=College_dormitories,basevar=totpop); %percent(compvar=Military_quarters,basevar=totpop); %percent(compvar=other_noninstitution_gp,basevar=totpop); *--8. Housing Occupancy and Tenure --; tot_units=h1i1; occupied_units=h2i1; owner_occupied=h3i1; renter_occupied=h3i2; vacant_units=sum (of h5i1 - h5i6); vacantforrent=h5i1; vacantforsale=h5i2; seas_rec_use=h5i4; if (h3i1+h5i2) gt 0 then ownervacrate=(h5i2/(h5i2+h3i1))*100; format ownervacrate 5.2; if (h3i2+h5i1) gt 0 then rentalvacrate=(h5i1/(h5i1+h3i2))*100; format rentalvacrate 5.2; avgsize_owner=h18ai1; format avgsize_owner 5.2; avgsize_renter=h18ai2; format avgsize_renter 5.2; %percent(compvar=tot_units,basevar=tot_units); %percent(compvar=occupied_units,basevar=tot_units); %percent(compvar=owner_occupied,basevar=tot_units); %percent(compvar=renter_occupied,basevar=tot_units); %percent(compvar=vacant_units,basevar=tot_units); %percent(compvar=vacantforrent,basevar=tot_units); %percent(compvar=vacantforsale,basevar=tot_units); %percent(compvar=seas_rec_use,basevar=tot_units); retain yr '90'; keep sumlev geocode state stab areaname county cousubce place tract bg cd xcentrm ycentrm areasqmi totpop -- yr; run; proc sort data=stf901x2.&set; by sumlev geocode; run; %if %index(&set,blks) %then %do; proc datasets library=stf901x2 ; modify &set; index create county; quit; %end; %mend cnvt; %cnvt(moi) ; %cnvt(moblks); %cnvt(ksi) %cnvt(ili)