x cd /pub/sas/formats/Tools; %let pgm=alt_cbsas; filename pgm "&pgm..sas"; *---We want to create alternative formats that put names to cbsa codes for specific time periods. The codes not change ane the names will. geocorr14 user pointed out that we were providing the 2013 names for the 2009 / 2010 Boston CBSA because it changed over time. ---; libname georef '/pub/data/georef'; *----We shall merge the georef files for the various time periods and see what codes have changed. Then we can manually code the new format defns where we create reference to the current value as other= specs. ---; data georef.cbsa_name_changes; merge georef.cbsas09(in=in09 rename=(areaname=areaname09 cbsatype=cbsatype09 csa=csa09)) georef.cbsas13(in=in13 rename=(areaname=areaname13 cbsatype=cbsatype13 csa=csa13)) georef.cbsas15(in=in13 rename=(areaname=areaname15 cbsatype=cbsatype15 csa=csa15)) ; BY CBSA; options mprint; if in09 then do; ix=index(areaname09,'Metropolitan Statistical') ; if ix then substr(areaname09,ix)=' '; ix=index(areaname09,'Micropolitan Statistical') ; if ix then substr(areaname09,ix)=' '; end; %macro compare(yr,curyr); ( areaname&yr ne areaname&curyr ) or (cbsatype&yr ne cbsatype&curyr) /* or (csa&yr ne csa&curyr) */ %mend compare; if %compare(09,15) or %compare(13,15) then output; drop year states nstates ix; run; proc print data=georef.cbsa_name_changes(drop=csaname); run;