x cd /pub/data/popests/Tools; %let pgm=uscomXX_greatermo; filename pgm "&pgm..sas"; *---create a "greater Missouri" dataset from the US components of change dataset which will include data for all counties either in Missouri or in a CBSA that includes Mo. jgb, 9/07. ---*; libname popests '/pub/data/popests'; proc sql noprint; select distinct cbsa into :cbsacds separated by ' ' from popests.mocom06 where cbsa ne ' '; quit; %put cbsacds= &cbsacds; data popests.mopluscom06(label='Greater Mo subset: includes MO and all counties in MO CBSAs'); set popests.uscom06; where (index("&cbsacds",cbsa) > 0) or state='29'; run; proc freq data=popests.mopluscom06; table cbsa*state; format cbsa $cbsa. state $fipstab.; run; proc print data=popests.mopluscom06(keep=state county cbsa areaname cbsaname); where state ne '29'; format county $5.; title 'Counties Outside MO in popests.mopluscom06'; run;