x cd /pub/data/stf903x2/Tools; %let pgm=cnvtstf903x2; filename pgm "&pgm..sas"; ############################ OBSOLETE INITIAL VERSION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!##### /*---Access a 1990 stf3 dataset and create a standard extract dataset specifically designed to be compatible with the std extract sets created from the 2000 sf3 data (filetype sf32000x). Input filetype is stf903, output filetype is stf903x2. This setup DEFINES what the stf903x2 standard extract is. John Blodgett, Evelyn Cleveland, OSEDA, U. of Missouri Outreach & Extension. Under contract with the Missouri Census Data Center. Initial version 8/20/02 ---*/ libname stf903 "/pub/data/stf903" access=readonly; libname stf903x2 "/pub/data/stf903x2"; %let filetype=stf903x2; title "&pgm: Create stf903x2 Extract Datasets from stf903 Complete Table Datasets"; %global Pctof table curtable curtabno dvmode; %let curtabno=0; %let reftables=; %include '/pub/sas/macros/dovarsf3.sas'/source2; *<----dovars macro defined here-------------------; %macro cnvtmeta(mode,moregeos=,setin=,setout=); %global dvmode; %let dvmode=&mode; %if &dvmode = %str(data) %then %do; %if &setout=%str() %then %let setout=&setin; *---------Here is the conversion data step-------------*; data stf903x2.&setout ; length default=5; set stf903.&setin; ***(rename=(slvl=SumLev)); if geocomp in(' ','00'); *--so even if not on the input set this works--; retain _val .; length geocode $16 slvl $3; if SumLev=' ' then SumLev=slvl; slvl=SumLev; *--we have it by both names--; if sumlev='040' then geocode=state; else geocode=county; *****for now***; select(SumLev); *---Assign the standardized Geographic Code to uniquely ID the geographic area--; when('010') geocode=' '; when('020') geocode=region; when('030') geocode=division; when('040') geocode=state; when('050') geocode=county; when('060') geocode=%concatd(county,cousubfp); when('070') geocode=%concatd(county,cousubfp,placefp); when('080') geocode=%concatd(county,cousubfp,placefp,tract); when('085') do; geocode=%concatd(county,cousubfp,placefp,tract,UrbanRur); Areaname = "Census Tract "||tract||" ("||TRIM(areaname)||" part)" ; end; when('090') geocode=%concatd(county,cousubfp,placefp,tract,UrbanRur,bg); when('067') geocode=%concatd(county,cousubfp,SubMCD); when('140') geocode=%concatd(county,tract); when('144') geocode=%concatd(county,tract,aianhhfp); when('150') geocode=%concatd(county,tract,bg); when('154') geocode=%concatd(county,tract,bg,aianhhfp); when('155') do; geocode=%concatd(county,placefp); *<===Override areaname to make it the name of the place rather than the county.To leave as-is delete this + next 4 lines; length _arg $7; _arg=state||placefp; drop _arg; areaname=put(_arg,$fplace.); if areaname=_arg then areaname='Place '||placefp; end; when('158') geocode=%concatd(state,placefp,cnty,tract); when('160') geocode=%concatd(state,placefp); when('170') geocode=%concatd(state,concit); when('172') geocode=%concatd(state,concit,placefp); when('250') geocode=aianhh; when('260') geocode=%concatd(aianhhfp,state); when('270') geocode=%concatd(aianhhfp,cnty); when('271') geocode=%concatd(aianhhfp,cnty,cousubfp); when('273') geocode=%concatd(aianhhfp,cnty,cousubfp,placefp); when('252') geocode=aianhh; when('262') geocode=%concatd(aianhhfp,state); when('272') geocode=%concatd(aianhhfp,cnty); when('275') geocode=%concatd(aianhhfp,cnty,cousubfp); when('276') geocode=%concatd(aianhhfp,cnty,cousubfp,placefp); when('254') geocode=aianhh; when('264') geocode=%concatd(aianhhfp,state); when('274') geocode=%concatd(aianhhfp,cnty); when('277') geocode=%concatd(aianhhfp,cnty,cousubfp); when('278') geocode=%concatd(aianhhfp,cnty,cousubfp,placefp); when('256','291','292') geocode=%concatd(aianhhfp,tract); when('258','293','294') geocode=%concatd(aianhhfp,tract,bg); when('251','253','255') geocode=%concatd(aianhhfp,aits); when('257') geocode=%concatd(aianhhfp,aits,tract); when('259') geocode=%concatd(aianhhfp,aits,tract,bg); when('290') geocode=%concatd(aianhhfp,aits,state); when('280','283','286') geocode=%concatd(state,aianhhfp); when('282','285','288') geocode=%concatd(state,aianhhfp,cnty); when('261','265','267') geocode=%concatd(state,aianhhfp,cnty,cousubfp); when('263','266','268') geocode=%concatd(state,aianhhfp,cnty,cousubfp,placefp); when('281','284','287') geocode=%concatd(state,aianhhfp,aits); when('230') geocode=%concatd(state,anrc); when('380') geocode=msacmsa; when('381') geocode=%concatd(msacmsa,state); when('382') geocode=%concatd(msacmsa,state,placefp); when('383') geocode=%concatd(msacmsa,state,cnty); when('384') geocode=%concatd(msacmsa,state,cousubfp); when('385') geocode=pmsa; when('386') geocode=%concatd(pmsa,state); when('387') geocode=%concatd(pmsa,state,cnty); when('388') geocode=%concatd(pmsa,state,cousubfp); when('370') geocode=necma; when('371') geocode=%concatd(necma,state); when('372') geocode=%concatd(necma,state,placefp); when('373') geocode=%concatd(necma,state,cnty); when('390') geocode=%concatd(state,msacmsa); when('391') geocode=%concatd(state,msacmsa,placefp); when('392') geocode=%concatd(state,msacmsa,cnty); when('393') geocode=%concatd(state,msacmsa,cnty,cousubfp); when('395') geocode=%concatd(state,msacmsa,pmsa); when('396') geocode=%concatd(state,msacmsa,pmsa,cnty); when('397') geocode=%concatd(state,msacmsa,pmsa,cnty,cousubfp); when('374') geocode=%concatd(state,necma); when('375') geocode=%concatd(state,necma,placefp); when('376') geocode=%concatd(state,necma,cnty); when('420') geocode=%concatd(state,UA); when('461') geocode=%concatd(state,UA,placefp); when('463') geocode=%concatd(state,UA); when('465') geocode=%concatd(state,UA,placefp); when('431') geocode=%concatd(state,UA,county); when('441') geocode=%concatd(state,UA,county,cousubfp); when('451') geocode=%concatd(state,UA,county,cousubfp,placefp); when('500') geocode=%concatd(state,cd106); when('510') geocode=%concatd(state,cd106,cnty); when('511') geocode=%concatd(state,cd106,cnty,tract); when('521') geocode=%concatd(state,cd106,cnty,cousubfp); when('531') geocode=%concatd(state,cd106,placefp); when('541') geocode=%concatd(state,cd106,concit,placefp); when('550','551','552') geocode=%concatd(state,cd106,aianhhfp); when('553','554','555') geocode=%concatd(state,cd106,aianhhfp,aits); when('850') geocode=zcta3; when('860') geocode=zcta5; when('851') geocode=%concatd(state,zcta3); when('852') geocode=%concatd(state,zcta3,cnty); when('871') geocode=%concatd(state,zcta5); when('881') geocode=%concatd(state,zcta5,cnty); end; %end; %else %if &dvmode=%str(meta) %then %do; *------Here is the data step that generate sf3x.Variables when dvmode=meta-----------; data stf903x2.Variables(label="Meta data describing the variables on these datasets"); attrib Name label='Variable Name' length=$32 Label length=$80 Definition length=$200 label='Definition - Code used to derive' Comment length=$400 Format length=$16 TypeLen length=$8 label='Variable type and length' Universe length=$64 UnivVar length=$32 label='Universe Variable' WtVar length=$32 label='Weight Variable' PctFlag length=3 label='Pct Variable Flag' Table length=$64 TableNo length=3 label='Table #' Keywords length=$80 Year length=$4 Source length=$40 ; *** OtherYears label='Other Years Available' length=$32; retain Year '1990'; *<===================; retain Source 'Summary File 3, 1990 Census'; *<===============; %end; %else %put ***** dvmode parm value not recognized: value= &dvmode ; options mprint nosymbolgen; %let display=1; %let table=%str(Total Population); %let universe=Total Population; %let lvl=0; %let Pctof= ; %dovar(TotPop,%str(Total Persons (Sample Est)),p1i1); %dovar(SampCount,Unweighted Sample Count of Persons,p2i1); %dovar(TotPop100,%str(Total Persons (100% Count)),p3i1); %dovar(PctSample,Pct Persons Sampled,p3ai1,wtvar=TotPop100,fmt=5.1); %let Pctof=TotPop; %let universe=Total Population; %dovar(Urban,Urban Population,%str(p6i1 + p6i2)); %dovar(InUAs,In Urbanized Areas,p6i1); %dovar(InUCs,In Urban Clusters,Urban - INUAs); %dovar(OnFarms,Persons on Farms,p6i3); %dovar(Rural,Rural Population,%str(p6i3 + p6i4)); %let Pctof=; /* if areasqmi then _val=TotPop/areaSQMI; else _val=.; */ %dovar(PopPerSQM,Persons Per Sq Mile,%str(TotPop/areasqmi),fmt=7.1); %let table=%str(Age); %let Pctof=TotPop; %dovar(Age0_4,Under 5 ,%str(sum(of p13i1-p13i3))); %dovar(Age5_9,Age 5 to 9,%str(sum(of p13i4-p13i6))); %dovar(Age10_14,10 to 14,%str(sum(of p13i7-p13i9))); %dovar(Age15_17,15 to 17,%str(sum(of p13i10-p13i12))); %dovar(Age18_19,18 to 19,%str(sum(of p13i13-p13i14))); %dovar(Age20_24,20 to 24,%str(sum(of p13i15-p13i17))); %dovar(Age25_34,25 to 34,%str(sum(of p13i18-p13i19))); %dovar(Age35_44,35 to 44,%str(sum(of p13i20-p13i21))); %dovar(Age45_54,45 to 54,%str(sum(of p13i22-p13i23))); %dovar(Age55_59,55 to 59,p13i24); %dovar(Age60_64,60 to 64,%str(sum(of p13i25-p13i26))); %dovar(Age65_74,65 to 74,%str(sum(of p13i27-p13i28))); %dovar(Age75_84,75 to 84,%str(sum(of p13i29-p13i30))); %dovar(Over85,Over 85,p13i31); %dovar(Under18,Under 18,%str(sum(of Age0_4 -- Age15_17))); %dovar(Over18,Over 18,%str(TotPop - Under18)); %dovar(Age18_64,18 to 64,%str(sum(of p13i1-p13i26))); %dovar(Over21,Over 21,%str(sum(of p13i16-p13i31))); %dovar(Over62,Over 62,%str(sum(of p13i26-p13i31))); %dovar(Over65,Over 65,%str(sum(of p13i27-p13i31))); %let table=%str(Race/Hispanic); %let Pctof=TotPop; %dovar(White1,White,p9i1); %dovar(Black1,Black,p9i2); %dovar(Indian1,Amer Indian Alaska Native,%str(sum(of p9i3-p9i5))); %dovar(Asian1,Asian,%str(sum(of p9i6-p9i16))); %dovar(HawnPI1,Hawaiian and Other PI,%str(sum(of p9i17-p9i24))); %dovar(Other1,Other race,p9i25); %dovar(HispPop,Hispanic,p10i1); %dovar(White1NH,White Not Hispanic,p12i1); %dovar(Minority,Minority Pop,%str(TotPop - White1NH)); %let table=%str(Relationship of Persons in Households); %let Pctof=TotPop; %dovar(HHPop,Persons in Households,%str(sum(of p17i1-p17i14))); %let Pctof=HHpop; %dovar(Householder,Householder in Family household,p17i1); %dovar(Spouse,Spouse in family household,p17i2); %dovar(Child,Child in family houshold,%str(sum(of p17i3-p17i4))); %dovar(Other_relative,Other Relative,%str(sum(of p17i5-p17i6))); %dovar(NonRelative,Nonrelatives,p17i7); %let table=%str(Households by Type); %let universe=Households; %let Pctof=; %dovar(TotHHs,Total Households,p5i1); %let Pctof=TotHHs; %dovar(Families,,p4i1); %dovar(MarriedCouples,Married Couples,%str(sum(of p19i1-p19i2))); %dovar(CouplesWithKids,%str(Married Couples w Own Children < 18),p19i1); %dovar(SingleParents,Single Parent Families,%str(P19i3 + P19i5)); %dovar(SingleMothers,Single Mothers,P19i5); %dovar(OtherFamilies,Other Families,%str(Families - ( MarriedCouples + SingleParents))); %dovar(NonFamHHs,%str(Non-Family HHs),P19i7); %dovar(LivingAlone,Persons Living Alone,P16i1); %let table=%str(Marital Status); %let Pctof=TotPop; %dovar(Over15,Persons Over 15 Yrs of Age,%str(sum(of p27i1-p27i12))); %let Pctof=Over15; %dovar(NeverMarried,Never Married,%str(p27i1 + p27i7)); %dovar(Married,Now Married Not Separated,%str(p27i2 + p27i8)); %dovar(Separated,Separated,%str(p27i3 + p27i9)); %dovar(Widowed,Widowed,%str(p27i5 + p27i11)); %dovar(Divorced,Divorced,%str(p27i6 + p27i12)); %let table=%str(Language Spoken at Home); %let universe=Persons 5 and Over; %let Pctof=TotPop; %dovar(Over5,Over 5 Yrs of Age,%str(sum(of p13i4-p13i31))); %let Pctof=Over5; %dovar(EnglishOnly,Speak English Only,%str(sum(of p28i1 p28i11 p28i21))); %dovar(EnglishLimited,%bquote(Speak Eng less than "very well"), %str(sum(of p28i3 p28i13 p28i23 p28i6 p28i16 p28i26 p28i9 p28i19 p28i29))); %dovar(NoEnglish,Do Not Speak English, %str(sum(of p28i4 p28i14 p28i24 p28i7 p28i17 p28i27 p28i10 p28i20 p28i30))); %let table=%str(Foreign Born Persons); %let universe=Foreign Born Persons; %let Pctof=TotPop; %dovar(ForeignBorn,%str(Foreign Born, exc native),%str(sum(of p37i2-p37i3 p37i5-p37i6))); %dovar(Naturalized,Naturalized US Citizen,%str(p37i2+p37i5)); %dovar(NonCitizen,Not a Citizen,%str(p37i3 + p37i6)); %dovar(EnteredLast10Yrs,Foreign Born Entered US in last 10 yrs.,%str(sum(of p36i1-p36i4))); %let table=%str(Residence in 1985); %let universe=Persons Over 5; %let Pctof=Over5; %dovar(SameHouse,Lived in Same House 5 Yrs Ago,p43i1); %dovar(SameCounty,Lived in Same County 5 Yrs Ago,%str(p43i1 + p43i2)); %dovar(SameState,Lived in Same State 5 Yrs Ago,%str(sum(of p43i1-p43i3))); %let table=%str(Place of Work); %let Pctof=; %dovar(Worker16,Workers 16 and Over,%str(sum(of p45i1-p45i3))); %let Pctof=Worker16; %dovar(WorkInCounty,Work in County of Residence,P45i1); %dovar(WorkersInaPlace,Worker Living in a Place,P45i2); %dovar(WorkInPlace,Work in Place of Residence,P46i1); %let table=%str(Commuting); %let Pctof=Worker16; %dovar(DriveAlone,Drive Alone to Work,P49i1); %dovar(Carpool,,P49i2) %dovar(PublicTrans,Public Transportation or Taxi to Work,%str(sum(of p49i3-p49i8))); %dovar(CycleWalk,Cycled or Walked to Work,%str(sum(of P49i9-p49i11))); %dovar(WorkAtHome,Work at Home,P49i13); %let Pctof=; %dovar(AvgCommute,Mean Travel Time to Work,%str(sum(of p50i1-p50i12)/p51i1)); %let table=%str(School Enrollment, Persons Age 3+); %let universe=Persons Age 3 and Over; %let Pctof=TotPop; %dovar(Over3,Over 3 Yrs of Age,%str(sum(of p54i1-p54i7))); %let Pctof=Over3; %dovar(EnrolledK12,Enrolled in grades K-12,%str(sum(of p54i3 p54i4))); %dovar(InPvtSchools,Enrolled in Private Schools K-12,p54i4); %dovar(InCollege,Enrolled in college,%str(p54i5 + p54i6)); %let table=%str(Educational Attainment); %let universe=Persons 25 and Over; %let Pctof=TotPop; %dovar(Over25,Persons Age 25 Yrs and Over,%str(sum(of p57i1-p57i7))); %let Pctof=Over25; %dovar(LessThan9th,Less than 9th Grade,p57i1); %dovar(SomeHighSchool,9th thru 12th grade no diploma,p57i2); %dovar(HighSchool,High School Graduate or GED, P57i3); %dovar(NoCollege,Did not attend college,%str(LessThan9th + SomeHighSchool + HighSchool)); %dovar(SomeCollege,Some college no degree,%str(p57i4 + p57i5)); %dovar(Bachelors,Bachelors,p57i6); %dovar(GradProf,Graduate or Professional Degree,p57i7); %let table=%str(Veteran and Armed Forces Status); %let universe=Persons 16 and over; %let Pctof=TotPop; %dovar(Over16,Persons Age 16 Yrs and Over,%str(sum(of p64i1-p64i12)),comment=persons 16+ in 1990 instead of 18+ in 2000); %let Pctof=Over16; %dovar(ArmedForces,Persons in Armed Forces,%str(sum(of p61i1 p64i4 p64i7 p64i10))); %dovar(Civilian,Civilian Poulation Ages 16 and Over,%str(sum(of p64i2 p64i3 p64i5 p64i6 p64i8 p64i9 p64i11 p64i12))); %dovar(Veteran,Veteran,%str(sum(of p64i2 p64i5 p64i8 p64i11))); %let table=%str(Disability); %dovar(DisabledUniv,Civilian NonInstitutionalized Pop. 16 Yrs and Over,%str(sum(of p66i1-p66i28)), comment=%str(Universe equals persons age 16 and over instead of 5 and over as in 2000)); %dovar(DisabledUniv65,Civilian NonInstitutionalized Pop. 65 Yrs and Over,%str(sum(of p66i15-p66i28))); %let Pctof=DisabledUniv65; %dovar(Disabled65,Persons 65 and Over with disability,%str(sum(of p66i15-p66i18 p66i22-p66i25))); %dovar(DisabledUniv16,Civilian NonInstitutionalized Pop.Age 16-64,%str(sum(of p66i1-p66i14))); %let Pctof=DisabledUniv16; %dovar(WorkDisability,Persons 16-64 w employment disability,%str(sum(of p66i1-p66i4 p66i8-p66i11))); %let table=%str(Employment Status); %let universe=Persons 16 Years and Over; %let Pctof=TotPop; %dovar(Over16,Persons 16 Years and Over,%str(sum(of p70i1-p70i8))); %let Pctof=Over16; %dovar(CivLabForce,Civilian Labor Force,%str(sum(of p70i2-p70i3 p70i6-p70i7))); %let Pctof=CivLabForce; %dovar(Unemployed,Unemployed Civilian Labor Force,%str(p70i3 + p70i8)); %let Pctof=CivLabForce; %dovar(CivLabForceFem,%str(Civ Labor Force, Female),%str(p70i6 + p70i7)); %let Pctof=CivLabForceFem; %dovar(UnemployedFem,Unemployed Females in Civ Labor Force,p70i7); %let Pctof=Over16; %dovar(NotInLF,Persons Not in Labor Force,%str(p70i4 + p70i8)); %let table=%str(Industry); %let universe=Civilian Labor Force; %let Pctof=CivLabForce; %dovar(EmployedCLF,Employed Civilian Labor Force,%str(p70i2 + p70i6)); %let Pctof=EmployedCLF; %dovar(Manufacturing,Employed in a manufacturing industry,p77i4); %dovar(RetailTrade,Employed in Retail Trade,p77i9); %dovar(Education,Employed in Educational Services,p77i15); %dovar(HealthSA,Employed in Health care and social assistance,p77i14); %dovar(OtherIndustry,Employed in Other Industries,%str(EmployedCLF - Manufacturing - RetailTrade - Education - HealthSA)); %let Pctof=CivLabForce; %dovar(Unemployed,Unemployed,%str(CivLabForce - EmployedCLF)); %let table=%str(Occupation); %let universe=Employed Civilian Labor Force; %let Pctof=EmployedCLF; %dovar(ManProfOccs,Management professional and related occupations,%str(p78i1 + p78i2)); %dovar(ServiceOccs,Service Occupations,%str(p78i6 + p78i7 +p78i8)); %dovar(SalesOffOccs,Sales and Office Occupations,p78i4); %dovar(FarmFishOccs,%str(Farming, Fishing and Forestry),p78i9); * %dovar(ConsOccs,Construction,p77i3); %dovar(TransOccs,Production Transportation and Material Moving,p78i12); %let table=%str(Household Income in 1989); %let universe=Households; %let Pctof=; %dovar(TotHHs,Total Households,p5i1) %let Pctof=TotHHs; %dovar(HHInc0,%str(Less than $10,000),%str(sum(of p80i1-p80i2))); %dovar(HHInc10,%str($10,000 to $14,999),%str(sum(of p80i3-p80i4))); %dovar(HHInc15,%str($15,000 to $24,999),%str(sum(of p80i5-p80i8))); %dovar(HHInc25,%str($25,000 to $34,999),%str(sum(of p80i9-p80i12))); %dovar(HHInc35,%str($35,000 to $49,999),%str(sum(of p80i13-p80i18))); %dovar(HHInc50,%str($50,000 to $74,999),%str(sum(of p80i19-p80i21))); %dovar(HHInc75,%str($75,000 to $99,999),p80i22); %dovar(HHInc100,%str($100,000 to $149,999),%str(sum(of p80i23-p80i24))); %dovar(HHInc150,%str($150,000 or More),p80i25); %let Pctof=; %dovar(MedianHHInc,Median Household Income,%str(p80Ai1*1.304650),wtvar=TotHHs,fmt=dollar8., comment=%str(cpi factors for 1989 and 1999 used 187.1 and 244.1 resp)); %dovar(AvgHHInc,Average Household Income,%str(p81i1 + p81i2 / p5i1*1.304650),wtvar=TotHHs,fmt=dollar8., comment=%str(cpi factors for 1989 and 1999 used 187.1 and 244.1 resp)); %let table=%str(Income Percentages by Source); %let universe=Households; %let Pctof=TotHHs; %let Pctof=; %dovar(TotalIncome,Titak Aggregate Household Income in 1989,%str(p81i1+p81i2*1.304650), comment=%str(cpi factors for 1989 and 1999 used 187.1 and 244.1 resp) fmt=dollar12.,len=8); %dovar(PctWages,Portion of Income from Wages and Salaries,%str(p98i1 / TotalIncome * 100),wtvar=TotalIncome,fmt=5.1); %dovar(PctSocSec,Portion of Income from Social Security,%str(p102i1 / TotalIncome * 100),wtvar=TotalIncome,fmt=5.1); %dovar(PctPubAssist,Portion of Income from Public Assistance,%str(p103i1 / TotalIncome * 100),wtvar=TotalIncome,fmt=5.1); %dovar(PctRetirement,Portion of Income From Retirement Income,%str(p104i1 / TotalIncome * 100),wtvar=TotalIncome,fmt=5.1); %let table=%str(Other Income Measures); %let universe=Families or Persons; %let Pctof=; %dovar(MedianFamInc,Median Family Income,p107Ai1*1.304650,wtvar=Families,fmt=dollar8., comment=%str(cpi factors for 1989 and 1999 used (187.1 and 244.1, resp))); %dovar(AvgFamInc,Average Family Income,%str(sum(of p108i1-p108i2) / p4i1)*1.304650,wtvar=Families,fmt=dollar8., comment=%str(cpi factors for 1989 and 1999 used (187.1 and 244.1, resp))); %dovar(PCI,Per Capita Income,%str(p114Ai1*1.304650),wtvar=TotPop,fmt=dollar8., comment=%str(cpi factors for 1989 and 1999 used (187.1 and 244.1, resp))); %let table=%str(Poverty); %let universe=Persons for whom poverty status is determined; %let Pctof=TotPop; %dovar(PovUniverse,Persons for whom poverty status determined,%str(sum(of p121i1-p121i9))); %let Pctof=PovUniverse; %dovar(Poor,Poor Persons,%str(sum(of p117i13-p117i24))); %dovar(VeryPoor,%quote(Persons below 50% of poverty level),p121i1); %dovar(Under185Poor,,%str(PovUniverse - p121i8 - p121i9)); %dovar(NearlyPoor,Not poor but not well off,%str(PovUniverse - Poor - P121i9),comment=Persons with poverty ratio between 1 and 2) %let PctOf=; %dovar(MeanPovRatio,Mean Poverty Ratio, %str((P121i1*.25 + P121i2*.625 + P121i3*.875+P121i4*1.125+P121i5*1.375+P121i6*1.625+P121i7*1.800+P121i8*1.925+P121i9*3.0)/PovUniverse),wtvar=PovUniverse,fmt=5.1, comment=Our own statistical invention which attempts to create a measure of the degree of poverty by estimating the average poverty ratio for persons) ; %let table=%str(Miscellaneous Population); %let universe=Total Population; %let Pctof=TotPop; %dovar(Female,Female Population,p7i2); %dovar(GQPop,In Group Qtrs Pop,%str(sum(of p40i1-p40i10))); %dovar(InInstitutions, Institutionalized Population,%str(sum(of p40i1-p40i5))); %let table=%str(Housing Units); %let universe=Housing Units; %let Pctof=; %dovar(TotHUs,Total Housing Units,h1i1); %dovar(SampHUs,Unweighted Sample HU Count,h2i1); %dovar(TotHUs100,%str(Total Housing Units 100% Count),h3i1); %let Pctof=TotHUs; %dovar(UrbanHUs,HUs in urban areas,%str(sum(of h5i1-h5i2))); %dovar(RuralHUs,HUs in rural areas,%str(sum(of h5i3-h5i4))); %dovar(Occupied,Occupied housing units,h4i1); %let Pctof=Occupied; %dovar(OwnerOcc,Owner Occupied Housing units,h8i1); %let Pctof=Occupied; %dovar(RenterOcc,Renter Occupied housing units,h8i2); %let Pctof=TotHUs; %dovar(Vacant,Vacant housing units,h4I2); %let table=%str(Select Housing Characteristics); %let Universe=Occupied housing units; %let PctOf=Occupied; %dovar(Plumbing,Lacking complete plumbing facilities,%str(h71i5-h71i8)); %dovar(NoPhone,Lacking telephone service,%str(h35i2 + h35i4)); %dovar(NoCars,No vehicles available,%str(h37i1 + h37i7)); %let Pctof=; %dovar(AvgHHSize,Average Persons per household,%str(TotPop / TotHHs)); %let PctOf=Occupied; %dovar(MovedIn5,Moved in within last 5 years,%str(h29i1 + h29i2)); %let table=%str(Units in Structure); %let universe=Housing Units; %let Pctof=TotHUs; %dovar(Units1,Single Family Housing Units,%str(sum(of h20i1-h20i2))); %dovar(Units2,%str(2 to 4-unit Housing Units),%str(sum(of h20i3-h20i4))); %dovar(Units5,%str(5 to 19-unit Housing Units),%str(sum(of h20i5-h20i6))); %dovar(Units20up,%str(Housing Units with 20+ Units),%str(sum(of h20i7-h20i8))); %dovar(MobileHomes,Mobile Homes,h20i9); %dovar(BoatRV,%str(Boat RV van etc.),h20i10); %let table=%str(Age of Structure); %let universe=Housing Units; %let Pctof=TotHUs; %dovar(AgeUnit5,%str(Units < 5 Yrs Old),%str(h25i1 + h25i2),comment=Units built between 1985 and March 1990); %dovar(AgeUnit50,%str(Units > 50 Yrs Old),h25i8,comment=This is same as BuiltBefore1940); %dovar(BuiltBefore1940,Built before 1940,h25i8); %let PctOf=; %dovar(AvgAgeUnit,Average Age of Units, %str((H25i3*.625 + H25i4*3.75 + H25i4*8.25 + H25i5*15.75 + H25i6*25.75 + H25i7*35.75 + H25i8*45.75 + h43i9*55.75 + h43i10*75)/TotHUs),wtvar=TotHUs,fmt=5.1, comment=%str(Our own statistic. Estimates ages within intervals using midpoints and assigns arbitrary age of 70 yrs for homes built 1939 and earlier)); %let table=%str(Gross Rents); %let universe=Specified Renter Occupied; %let Pctof=RenterOcc; %dovar(SpecRenter,%str(Specified renter-occupied units),%str(sum(of h43i1-h43i17))); %let Pctof=SpecRenter; %dovar(CashRenter,%str(With cash rent),%str(sum(of h43i1-h43i16))); * %dovar(RentUnder300,%str(Less than $300),%str(sum(of h43i1-h43i6))); * %dovar(Renter300,%str(Rent $300 to $599),%str(sum(of h43i7-h43i11))); * %dovar(Renter600,%str(Rent $600 to $999),%str(sum(of h43i12-h43i15))); * %dovar(RentOver1000,%str(Rent $1000 or more),%str(sum(of h43i16))); %let Pctof=; %dovar(MedianGrossRent,Median Gross Rent,%str(h43ai1*1.304650), comment=%str(cpi factors for 1989 and 1999 used 187.1 and 244.1 resp)); %dovar(AvgGrossRent,Average Gross Rent,%str(h44i1 / CashRenter*1.304650), comment=%str(cpi factors for 1989 and 1999 used 187.1 and 244.1 resp)); %let Pctof=SpecRenter; %dovar(NoCashRent,No cash rent,h43i17); %let table=%str(Housing Values); %let universe=Specified Owner Occupied Housing Unit; %let Pctof=OwnerOcc; %dovar(SpecOwner,Specified owner-occupied units,%str(sum(of h61i1-h61i20))); *%let Pctof=SpecOwner; * %dovar(HvalUnder50,%str(Housing Value: Less than $50,000),%str(sum(of h61i1-h61i8))); * %dovar(Hval50,%str(Housing Value: $50,000 - $99,999),%str(sum(of h61i9-h61i11))); * %dovar(Hval100,%str(Housing Value: $100,000 - $149,999),%str(sum(of h61i12-h61i13))); * %dovar(Hval150,%str(Housing Value: $150,000 - $199,999),%str(sum(of h61i14-h61i15))); * %dovar(Hval200,%str(Housing Value: $200,000 - $299,999),%str(sum(of h61i16-h61i17))); * %dovar(Hval300,%str(Housing Value: $300,000 - $499,999),%str(sum(of h61i18-h61i19))); * %dovar(Hval500,%str(Housing Value: $500,000 or more),h61i20); %let Pctof=; %dovar(MedianHValue,Median Value of Occupied Housing Unit,h61ai1*1.304650); ***dovar(HvalOverMillion,Housing Value: $1 000 000 and over,,); ****dovar(Vacant_for_Sale,Vacant for Sale Housing Units,,); ****dovar(Median_Price_Asked,Median Price Asked for Vacant Units,,); ****dovar(Avg_Price_Asked,Average Price Asked for Vacant Units,,); %if &dvmode=%str(data) %then %do; Obs+1; keep geocode sumlev slvl state county areaname &moregeos; keep TotPop -- Obs; drop _val geocomp; run; %end; %else %if &dvmode=%str(meta) %then %do; *-----meta processing-----------------------------; run; options nonumber nodate orientation=landscape nocenter; ods printer pdf file="../Variables.pdf" ; ods path work.templat(update) sashelp.tmplmst(read); proc template; %include '/pub/sascode/osedablue.sas'; *<====Optional style thing===; run; ods html file='../Variables.html' style=osedablue; ods listing close; proc print data=stf903x2.Variables label; where pctflag=0 or UnivVar=' '; *<--do not show the Pct variables unless they are stand-alone--; by table notsorted universe notsorted; id name; var label--comment UnivVar WtVar; title 'Metadata for the stf903x2 Filetype (Partial listing of Variables dataset)'; footnote 'Note: If Universe Variable has a value then there is a corresponding Pct Variable'; footnote2 'Example: PctWhite is defined and is 100*White/TotPop'; run; ods printer close; ods html close; %end; %mend cnvtmeta; %cnvtmeta(meta,setin=mostcnty) ; %libname (sf32000x); *<---compare variables names in the sf32000x filetype vs the stf903x2--; proc contents data=sf32000x.ilstcnty noprint out=sf3x(keep=name label type rename=(label=label2k)); run; proc sort; by name; run; proc contents data=stf903x2.mostcnty noprint out=st3x(keep=name label type rename=(label=label90)); run; proc sort; by name; run; data merged; merge sf3x(in=in2k) st3x(in=in90); by name; where type=1; drop type; run; options ls=150; ods listing; proc print data=merged; format label90 label2k $40.; title2 'Variables on the 2000 and 1990 sf3 extract sets'; run; %cnvtmeta(data,setin=mostcnty) ; %cnvtmeta(data,setin=motrs00); %cnvtmeta(data,setin=mobgs00); %cnvtmeta(data,setin=moplaces);