<?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: convert numeric to char-missing values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826133#M326313</link>
    <description>&lt;P&gt;The idea of converting numeric to character just so you can change the appearance of a value bothers me. When you want to change the appearance of something, you use a custom format or a built-in SAS format. It seems that this conversion from numeric to character isn't necessary, it's extra work with no apparent benefit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the custom format from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;, this works without the unnecessary step of changing from numeric to character:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
    var x;
    format x mybest.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As stated many times already,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;, please test your code before posting it. The code you posted generated errors.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 11:36:20 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-07-29T11:36:20Z</dc:date>
    <item>
      <title>convert numeric to char-missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826128#M326309</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to convert numeric into char.&lt;/P&gt;
&lt;P&gt;The problem is that the missing numeric values are converted into '.' and I want to have '' (without period).&lt;/P&gt;
&lt;P&gt;I can write a statement&amp;nbsp; IF C_char='.' then&amp;nbsp;C_char='';&lt;/P&gt;
&lt;P&gt;But my question if there is another way to do it?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x;
cards;
100
200
.
300
.
600
;
Run;

data want;
set have;
x_char=put(x,best.);
x_char2=put(x,8.-L);
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jul 2022 14:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826128#M326309</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-07-29T14:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric to char-missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826129#M326310</link>
      <description>&lt;P&gt;First, I would try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=" ";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I can't test in the moment if this also works for PUT functions.&lt;/P&gt;
&lt;P&gt;Or you use a custom format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value mybest
  . = " "
  other = [best.]
;
run;

data want;
set have;
x_char=put(x,mybest.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jul 2022 09:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826129#M326310</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-29T09:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric to char-missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826133#M326313</link>
      <description>&lt;P&gt;The idea of converting numeric to character just so you can change the appearance of a value bothers me. When you want to change the appearance of something, you use a custom format or a built-in SAS format. It seems that this conversion from numeric to character isn't necessary, it's extra work with no apparent benefit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the custom format from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;, this works without the unnecessary step of changing from numeric to character:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
    var x;
    format x mybest.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As stated many times already,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;, please test your code before posting it. The code you posted generated errors.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 11:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826133#M326313</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-29T11:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric to char-missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826172#M326331</link>
      <description>100%, always better to change the appearance (format) than convert from numeric to char.</description>
      <pubDate>Fri, 29 Jul 2022 14:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-to-char-missing-values/m-p/826172#M326331</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-07-29T14:57:25Z</dc:date>
    </item>
  </channel>
</rss>

