Hello, I'm currently using CPS ASEC data to tally all available counties in the data set. I combined state and county codes to create a standard FIPS State/County code and listed all counties in the US, including states containing unlisted counties (see code). This made for one very long PROC FORMAT.
I'm getting mixed results when I use and don't use the format. When the format is used, 241 levels are reported. When the format isn't used, 280 levels are reported. The 39 geographies that aren't in the original Proc Freq are listed in the Proc Format and are contained in the data set, so I don't understand why the original freq isn't displaying them.
Any insight appreciated.
data listed not_lstd; set work.ststst; if gxco = '000' then output not_lstd; else if gxco not = '000' then output listed; run; /*Gives frequencies for 329 levels identified and not-identified counties*/ proc freq data = work.ststst nlevels; table stcofips / missing; *no format; run; /*Gives frequencies for 241 identified counties*/ proc freq data = listed nlevels; table stcofips / missprint; format stcofips $counties. ; *format stcofips $counties. ; /*280 levels when omitted*/ run; /*Gives frequencies for 49 not-identified counties within states*/
proc freq data = not_lstd nlevels; tables stcofips / missprint; format stcofips $counties. ; run;
There are some very common county names such as Washington, Lincoln, Jefferson and Adams to pick on a few.
This code may help identify your problem cases.
proc sql; select distinct countynm, statename from sashelp.zipcode where state in (1:50) ; quit;
Or other information, if available, coupled with the SASHELP.ZIPCODE data set might help resolve some of the FIPS issues.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: