x cd /pub/data/acs/Tools; %let pgm=aggacstotbsa_boonetest; filename pgm "&pgm..sas"; *---we created a coding file and then we filled it in with the tbsa codes and names for areas in the Boone County, MO area (which also happens to be a PUMA unto itself). This is an experiment to see if it will be easy enought to aggregate acs 5yr data to these new geographic areas using the input equivalency file. jgb, 12/2010. ----*; libname acs2009 '/pub/data/acs2009'; libname corrlst '/pub/data/corrlst'; filename codeform '/pub/data/acs/tbsacoding/codingformBoonecounty.csv'; *---we generated the shell of this doc and then filled in the new columns at the end: tbsacode, tbsa_shportname and tbsa_longname using Excel.---*; filename fmats '/pub/data/georef/tbsafmats/boonetest.sas'; proc format ; invalue rdtract '**All**'=0; run; %macro jrlz(varname); %*--this macro will right-justify the variable whose name is passed and then will replace any blanks with zeroes--; &varname=translate ( right(&varname), '0',' '); %mend jrlz; data corrlst.boonetr2tbsa0509(label='Correlate Boone co, MO tracts to TBSAs (experimental)' drop=TBSAShortName TBSALongName) tbsanames(keep=state puma tbsa tbsashortname tbsalongname) ; length State $2 PUMA $5 County $5 Tract $7 _placefp $5 pop2k 5 _location $40 _pctinLoc 8 Popest0509 5 TBSA $2 TBSAShortName $8 TBSALongName $80; infile codeform dsd missover firstobs=2; informat _ntract rdtract. popest0509 comma.; input State PUMA County _ntract _placefp -- TBSALongName; if _ntract=0 then delete; *<----for this particular situation we do not use entire-county coding---; %jrlz(State) %jrlz(puma) tract=put(_ntract,z7.2); drop _: ; if tbsashortname ne ' ' then output tbsanames; output corrlst.boonetr2tbsa0509; run; *----Generate proc format source code to be used for putting names with tbsa codes----; %genfmat(sasin=tbsanames,argvars=state puma tbsa,arglen=9, labelvar=TBSAShortname, labellen=8, textfile=fmats,fmatname=tbsashrt, runproc=0) %genfmat(sasin=tbsanames,argvars=state puma tbsa,arglen=9, labelvar=TBSALongname, labellen=80, textfile=fmats,mod=mod,fmatname=tbsashrt, runproc=0) data _null_; infile fmats; input; list; run; proc means n sum data = corrlst.boonetr2tbsa0509(keep=tbsa popest0509) ; class tbsa; var popest0509; run; %include fmats/ source; run; *----Now do a sample application, merging the equivalency with the latest tract level mcdcprofiles data set and then aggregating to get data by these tbsa areas. ---*;