<?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: CATS Function Deleting Leading Zeros in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824211#M41129</link>
    <description>&lt;P&gt;I am assuming that you have numeric values for FIPSSTATE and COUNTY1 and both are formatted to show leading zeros. So what you are seeing is the default handling of numeric values converting to character within CATS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this, which converts the numbers to character strings with leading zeros with the Z format and then the leading zeros show up in the output from CATS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FIPS = cats( put(FIPSState,z2.), put(County1,z3.)) ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 18:31:49 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-07-19T18:31:49Z</dc:date>
    <item>
      <title>CATS Function Deleting Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824206#M41128</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I am trying to make the full fips code from the state number and county:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data Location2;
set Location2B;
FIPS = cats( FIPSState, County1) ;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example FIPSSTATE = 01&lt;/P&gt;&lt;P&gt;COUNTY1 = 073&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The FIPS is coming out&amp;nbsp; as 173.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can get it to not delete the leading zeros?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 18:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824206#M41128</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-19T18:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: CATS Function Deleting Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824211#M41129</link>
      <description>&lt;P&gt;I am assuming that you have numeric values for FIPSSTATE and COUNTY1 and both are formatted to show leading zeros. So what you are seeing is the default handling of numeric values converting to character within CATS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this, which converts the numbers to character strings with leading zeros with the Z format and then the leading zeros show up in the output from CATS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FIPS = cats( put(FIPSState,z2.), put(County1,z3.)) ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 18:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824211#M41129</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-19T18:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: CATS Function Deleting Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824212#M41130</link>
      <description>&lt;P&gt;The CATS() function only removes leading a trailing spaces.&lt;/P&gt;
&lt;P&gt;Perhaps the problem is that your variables a NUMERIC instead of CHARACTER?&amp;nbsp; Numbers do not have leading spaces or leading zeros.&amp;nbsp; There is no difference between the number represented 1 and 01 or 000001.&amp;nbsp; They are all the same number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to make a five character string from two numeric variable use the PUT() function and the Z format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FIPS = put(FIPSState,Z2.) || put(County1,Z3.) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But why did your two variables get defined as numeric instead character?&amp;nbsp; Perhaps you should fix the previous step that created the dataset you are using as input.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 18:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CATS-Function-Deleting-Leading-Zeros/m-p/824212#M41130</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-19T18:27:48Z</dc:date>
    </item>
  </channel>
</rss>

