<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Function for FIPS codes by County in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470662#M70902</link>
    <description>&lt;P&gt;Is there a way to create the standard naming for text like "Amelia US-01038" from the three digit FIPS county code?&amp;nbsp; I need to make sure that my name in my table for display has the same county name as that of the SAS tables.&amp;nbsp; So if there is a function for this I can pair it up perfectly.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jun 2018 17:28:11 GMT</pubDate>
    <dc:creator>DavidPhillips2</dc:creator>
    <dc:date>2018-06-15T17:28:11Z</dc:date>
    <item>
      <title>Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470125#M70856</link>
      <description>&lt;P&gt;Is there a&amp;nbsp;proc that&amp;nbsp;returns the FIPS code with inputs for state, county like fips(VA, Amelia) returns 24393.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 21:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470125#M70856</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-06-13T21:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470132#M70857</link>
      <description>&lt;P&gt;Close but no cigar &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="xis-generatedCategoryTable"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="xis-forScope" rowspan="12" scope="row"&gt;State and ZIP code&lt;/TH&gt;
&lt;TH class="xis-forScope" scope="row"&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0ntdwcmrqyn91n11gyzzfyksuhj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n0ntdwcmrqyn91n11gyzzfyksuhj.htm"&gt;FIPNAME Function&lt;/A&gt;&lt;/TH&gt;
&lt;TD&gt;Converts two-digit FIPS codes to uppercase state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n141omrpn3drdhn1j8setgzcp0dv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n141omrpn3drdhn1j8setgzcp0dv.htm"&gt;FIPNAMEL Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts two-digit FIPS codes to mixed case state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0w5c8mtph2dyjn1mrkgwkdhctbz.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n0w5c8mtph2dyjn1mrkgwkdhctbz.htm"&gt;FIPSTATE Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts two-digit FIPS codes to two-character state postal codes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0i3gjy45j9l4nn1s5yc7evr663b.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n0i3gjy45j9l4nn1s5yc7evr663b.htm"&gt;STFIPS Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts state postal codes to FIPS state codes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p1b79mh8tmxwgfn18h3oskwhj0kt.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="p1b79mh8tmxwgfn18h3oskwhj0kt.htm"&gt;STNAME Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts state postal codes to uppercase state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n02e99u1jvwz3vn1ig9jxeoo1gib.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n02e99u1jvwz3vn1ig9jxeoo1gib.htm"&gt;STNAMEL Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts state postal codes to mixed case state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n1h2lg5jz7wxh3n1c00jubsktp75.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n1h2lg5jz7wxh3n1c00jubsktp75.htm"&gt;ZIPCITY Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Returns a city name and the two-character postal code that corresponds to a ZIP code.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n1r333fdkrofhxn10vmhu9bq5m85.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n1r333fdkrofhxn10vmhu9bq5m85.htm"&gt;ZIPCITYDISTANCE Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Returns the geodetic distance between two ZIP code locations.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0bw9m85v1dynqn16n8u6q1gz5y9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n0bw9m85v1dynqn16n8u6q1gz5y9.htm"&gt;ZIPFIPS Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts ZIP codes to two-digit FIPS codes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p1en5dzvubdabmn1czrqdcq9ozv3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="p1en5dzvubdabmn1czrqdcq9ozv3.htm"&gt;ZIPNAME Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts ZIP codes to uppercase state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0t0artwb6ncrjn189ptdikni2uj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n0t0artwb6ncrjn189ptdikni2uj.htm"&gt;ZIPNAMEL Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts ZIP codes to mixed case state names.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="ng-scope" tabindex="0" href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n1sbbmgodev1j9n1f0gm6wcrrshg.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="nofollow" data-docset-id="lefunctionsref" data-docset-version="9.4" data-original-href="n1sbbmgodev1j9n1f0gm6wcrrshg.htm"&gt;ZIPSTATE Function&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;Converts ZIP codes to two-character state postal codes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 13 Jun 2018 21:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470132#M70857</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-13T21:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470141#M70858</link>
      <description>&lt;P&gt;Query the SASHELP.Zipcode data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
   select distinct catt(put(state,z2.),put(county,z3.)) as FIPS
   from sashelp.zipcode
   where statecode='VA' and Countynm='Amelia';
quit;&lt;/PRE&gt;
&lt;P&gt;or do a join on your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the catt and put as the values for state and county are numeric and would not appear as the correct 5 characters for a county FIPS code. Obviously if only want the county code then just use County.&lt;/P&gt;
&lt;P&gt;There are lots of other things in that set of interest as well. One reason to use DISTINCT is that each City/zipcode combination would generate a value.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 23:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470141#M70858</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-13T23:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470181#M70859</link>
      <description>&lt;P&gt;If the data exists you can roll your own using PROC FCMP or a format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 03:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470181#M70859</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-14T03:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470299#M70862</link>
      <description>&lt;P&gt;Trying to follow.&amp;nbsp; I need to convert United States, Alabama, Autauga to US-01001&amp;nbsp; I'm not sure if that is a ZIP code or something else called FIPS code.&amp;nbsp; I am reading the documentation in this thread.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 13:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470299#M70862</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-06-14T13:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470313#M70863</link>
      <description>&lt;P&gt;It took me a while to understand the code is a combination of two codes state and county.&amp;nbsp; Maybe there is more than one type of FIPS code and county codes are two digits.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 13:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470313#M70863</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-06-14T13:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470349#M70873</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It took me a while to understand the code is a combination of two codes state and county.&amp;nbsp; Maybe there is more than one type of FIPS code and county codes are two digits.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;FIPS codes are of variable lengths depending on purpose or&amp;nbsp;use. The first two characters, which should include a leading zero are the "state", and if the purpose is for state only use may stop there. The next &lt;STRONG&gt;three characters identify a county&lt;/STRONG&gt;. When the&amp;nbsp;county&amp;nbsp;FIPS codes were created&amp;nbsp;all the initial&amp;nbsp;codes were odd, 001, 003, 005 etc and assigned alphabetically, to allow a number of additional counties to be added and have a chance of maintaining alphabetical&amp;nbsp;order since new counties don't get created very often. Even if a state only has 4 counties the county part of the FIPS would be 001/3/5 or 7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Additional characters after the first 5&amp;nbsp;may identify such things as bridges, rest stops, road-side historical markers (you might make a guess where my education on this came from), parks,&amp;nbsp;federal buildings/facilities&amp;nbsp;and others. The added information would come after the state+&amp;nbsp;county but I don't remember how specific the rules were for number of characters and formats if any.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that the "state" part of the FIPS is not 01 to 50 as US protectorates such as Guam, Puerto Rico, Virgin Islands as well as Washing DC receive their own 2 character "state" code and some areas not counties (Louisiana parishes and Virgin Island islands for example) will be in the place of the 3 character "county" portion,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The additional part of your needed string should be relatively easy to prefix to my example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 15:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470349#M70873</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-14T15:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470662#M70902</link>
      <description>&lt;P&gt;Is there a way to create the standard naming for text like "Amelia US-01038" from the three digit FIPS county code?&amp;nbsp; I need to make sure that my name in my table for display has the same county name as that of the SAS tables.&amp;nbsp; So if there is a function for this I can pair it up perfectly.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 17:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470662#M70902</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-06-15T17:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Function for FIPS codes by County</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470810#M70912</link>
      <description>&lt;P&gt;To verify results, what's the actual FIPS code for Amelia, VA?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;51007?&lt;/P&gt;
&lt;P&gt;01038?&lt;/P&gt;
&lt;P&gt;24393?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there a way to create the standard naming for text like "Amelia US-01038" from the three digit FIPS county code?&amp;nbsp; I need to make sure that my name in my table for display has the same county name as that of the SAS tables.&amp;nbsp; So if there is a function for this I can pair it up perfectly.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the FIPS is, from what I'm reading, a combination of State + County codes then I would build a custom format and then use that to call it up as needed. The SASHELP.ZIPCODE table will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could probably use a hash lookup with two parameters to a user defined function, FCMP instead but I'm not very good at hash solutions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example of how that works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*remove duplicate state/county records;
proc sort data=sashelp.zipcode out=fips_data nodupkey;
    by countynm statecode;
run;

*create a format table for PROC FORMAT;
data custom_fips_fmt;
    set fips_data;
    fmtname='fips_fmt';
    start=catx(', ', countynm, statecode);
    label=catt(state, put(county, z3.));
    type='C';
run;

proc format cntlin=custom_fips_fmt;
run;

*demo usage;
data demo;
    County='Amelia';
    State='VA';
    fips=put(catx(', ', county, state), $fips_fmt.);
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 22:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Function-for-FIPS-codes-by-County/m-p/470810#M70912</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-16T22:33:53Z</dc:date>
    </item>
  </channel>
</rss>

