<?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: Numeric to character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879923#M347608</link>
    <description>&lt;P&gt;Hoe do the codes in the other dataset with the character variable look like?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 17:14:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-06-09T17:14:17Z</dc:date>
    <item>
      <title>Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879920#M347607</link>
      <description>I am using SAS VIYA and trying to convert a variable “ID” (data from an excel import) from numeric to character. I am trying to join it to the “ID” in another data set to bring back any matches.&lt;BR /&gt;&lt;BR /&gt;I’ve done this but it brings nothing back and want to make sure if that’s because there are no matches or because something is wrong with my input:&lt;BR /&gt;&lt;BR /&gt;Data c;&lt;BR /&gt;Set b;&lt;BR /&gt;ID_char=put(ID,8.);&lt;BR /&gt;Run;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879920#M347607</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2023-06-09T17:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879923#M347608</link>
      <description>&lt;P&gt;Hoe do the codes in the other dataset with the character variable look like?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879923#M347608</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-09T17:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879924#M347609</link>
      <description>&amp;nbsp;The ID is a six digit &amp;nbsp;number 123456&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879924#M347609</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2023-06-09T17:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879928#M347612</link>
      <description>Try adding the -l component and trim in case you have blanks?&lt;BR /&gt;&lt;BR /&gt;ID_Char = put(trim(ID), 8. -l);&lt;BR /&gt;&lt;BR /&gt;(PS not that familiar with Viya)</description>
      <pubDate>Fri, 09 Jun 2023 17:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879928#M347612</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-09T17:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879929#M347613</link>
      <description>&lt;P&gt;Then use the Z6. format instead of 8.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879929#M347613</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-09T17:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879930#M347614</link>
      <description>It looks like it worked but there is an ID that has a leading zero like 099999 but still shows as 99999.&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879930#M347614</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2023-06-09T17:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879932#M347615</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290946"&gt;@bhca60&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;It looks like it worked but there is an ID that has a leading zero like 099999 but still shows as 99999.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Shows where?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you send values to a spreadsheet quite often the rules of the spreadsheet will convert text containing digits to numeric which loses the leading zeros.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879932#M347615</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-09T17:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879933#M347616</link>
      <description>&lt;P&gt;That's why you need to use the Z format, which prints leading zeroes.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879933#M347616</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-09T17:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879934#M347617</link>
      <description>Right but I imported it to sas from excel and thought that it would include a 0 in the output after conversion to character.&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879934#M347617</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2023-06-09T17:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879935#M347618</link>
      <description>&lt;P&gt;Numbers do not have leading zeroes. You must force the display of leading zeroes by using the proper format during the conversion to character.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879935#M347618</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-09T17:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879944#M347621</link>
      <description>&lt;P&gt;Then you can use the Z6 format in your conversion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID_char = put(trim(ID), z6. -l);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879944#M347621</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-09T18:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879948#M347625</link>
      <description>And what if you want to remove leading zeros but keep it a character?&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879948#M347625</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2023-06-09T19:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879950#M347626</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Then you can use the Z6 format in your conversion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID_char = put(trim(ID), z6. -l);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do not use the TRIM() function with a NUMERIC variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no need to use the -L modifier with the Z format as there will not be any leading spaces to remove.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID_char = put(ID, z6.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879950#M347626</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-09T19:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879951#M347627</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID_char = put(input(id_char, 8.), 8. -l)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/879951#M347627</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-09T19:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/880036#M347688</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290946"&gt;@bhca60&lt;/a&gt;&amp;nbsp; - It is normally better to fix this problem in Excel and then re-import. Open Excel, select the ID column. In the Data tab, select the Text to Column wizard, and go through the dialog, selecting Text as your column type. Now, when you re-import into SAS your ID column type will stay as character. &lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 22:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-to-character/m-p/880036#M347688</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-06-10T22:37:16Z</dc:date>
    </item>
  </channel>
</rss>

