<?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: How to concatenate FIP state code and FIP county code (both character variable) into one variabl in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950459#M371687</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/304913"&gt;@cashaowan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am concatenating two separate character variables into one variable, specifically FIP state and FIP county variables, both character variables. I don't want any space between FIP state and county codes in the new FIPS code created for each county.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I use the following codes?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Best way to answer that question is to try it yourself and see what happens. SAS will give you a very quick answer, faster than you can get from this forum, and it will be 100% guaranteed correct (which isn't true if I try to answer SAS questions). You don't need our help here.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2024 16:16:11 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-11-12T16:16:11Z</dc:date>
    <item>
      <title>How to concatenate FIP state code and FIP county code (both character variable) into one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950447#M371683</link>
      <description>&lt;P&gt;I am concatenating two separate character variables into one variable, specifically FIP state and FIP county variables, both character variables. I don't want any space between FIP state and county codes in the new FIPS code created for each county.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I use the following codes?&lt;/P&gt;&lt;P&gt;Option 1: using traditional trim function&lt;/P&gt;&lt;P&gt;FIPS length $5.;&lt;/P&gt;&lt;P&gt;FIPS=trim(FIPstate)||trim(FIPcnty);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Option 2: using cats function&lt;/P&gt;&lt;P&gt;FIPs length $5.;&lt;/P&gt;&lt;P&gt;FIPS=cats(FIPstate,FIPcnty);&lt;/P&gt;&lt;P&gt;If there is no delimit adding to two digits FIPstate and three digits FIPcnty, can I use cat function this way to deliver the desired five-digit format FIPs code variable?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 15:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950447#M371683</guid>
      <dc:creator>cashaowan</dc:creator>
      <dc:date>2024-11-12T15:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate FIP state code and FIP county code (both character variable) into one variabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950459#M371687</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/304913"&gt;@cashaowan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am concatenating two separate character variables into one variable, specifically FIP state and FIP county variables, both character variables. I don't want any space between FIP state and county codes in the new FIPS code created for each county.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I use the following codes?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Best way to answer that question is to try it yourself and see what happens. SAS will give you a very quick answer, faster than you can get from this forum, and it will be 100% guaranteed correct (which isn't true if I try to answer SAS questions). You don't need our help here.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 16:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950459#M371687</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-11-12T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate FIP state code and FIP county code (both character variable) into one variabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950462#M371689</link>
      <description>&lt;P&gt;Do&amp;nbsp; your county codes have leading zeroes if the numeric value is less than 100? If not then you are creating a malformed FIPS code. 2 character FIPS is state, 5 character is State + County. If the "county" FIP code is 1 and the state code is 16 then the state+county is 16001. If your state is a single digit then it needs to have a leading 0.&lt;/P&gt;
&lt;P&gt;If your state and county codes have the leading 0 and they are defined as 2 character and 3 character then any of CAT, CATS or CATT would yield a 5 digit code &lt;STRONG&gt;IF you set the length before assigning. &lt;/STRONG&gt;Otherwise the function will default to $200.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   length Fipstate $ 2 Fipcnty $ 3;
   Fipstate='02';
   Fipcnty ='001';
   length F1 F2 F3 $ 5;
   F1 = cat(fipstate,fipcnty);
   F2 = cats(fipstate,fipcnty);
   F3 = catt(fipstate,fipcnty);

run;
   &lt;/PRE&gt;
&lt;P&gt;If they don't have leading zeroes you have more work to do to make sure they are there.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 16:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-concatenate-FIP-state-code-and-FIP-county-code-both/m-p/950462#M371689</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-12T16:31:37Z</dc:date>
    </item>
  </channel>
</rss>

