<?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 variable missing values to character variable missing values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358279#M84166</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, chance is very slim, yet possible:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	input num;
	char=put(num,8.);
	char_1=ifc(num&amp;gt;.,put(num,8.),'');
	char_2=ifc(not missing(num),put(num,8.),'');
	cards;
100
.
._
.A
.Z
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 May 2017 16:19:51 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2017-05-12T16:19:51Z</dc:date>
    <item>
      <title>convert numeric variable missing values to character variable missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358253#M84160</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I used an array to convert the numeric variables &amp;nbsp;to character variables. None of the numeric variables had any formats associated with it but all had a length of 8. The value for non-missing numeric values was 1 and the&amp;nbsp;value of missing numeric values was a period. I applied the character&amp;nbsp;fomat $40. as I need to reformat the values later. However, after conversion of the numeric to character the missing values are being retained as periods and not blanks. Is there a way to have them as blanks after the conversion? Please let me know as soon as possible. Thanks.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _numeric(*)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;var2&lt;/P&gt;
&lt;P&gt;var3&lt;/P&gt;
&lt;P&gt;var4&lt;/P&gt;
&lt;P&gt;var5&lt;/P&gt;
&lt;P&gt;var6;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _character(*) $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;var2_C&lt;/P&gt;
&lt;P&gt;var3_C&lt;/P&gt;
&lt;P&gt;var4_C&lt;/P&gt;
&lt;P&gt;var5_C&lt;/P&gt;
&lt;P&gt;var6_C&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dim(_numeric);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; _character(i) = PUT(_numeric(i),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 14:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358253#M84160</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2017-05-12T14:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable missing values to character variable missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358256#M84161</link>
      <description>&lt;P&gt;A simple change to one statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#FF0000"&gt;if _numeric(i) &amp;gt; . then&lt;/FONT&gt; _character(i) = PUT(_numeric(i),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;8.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 15:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358256#M84161</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-12T15:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable missing values to character variable missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358260#M84162</link>
      <description>&lt;P&gt;You can change the setting of the MISSING option. &amp;nbsp;Also be careful how you convert to character. Your current use of the PUT() function will cause your character variables to have leading spaces.&lt;/P&gt;
&lt;PRE&gt;2183  %let save=%sysfunc(quote(%qsysfunc(getoption(missing))));
2184  options missing=' ';
2185  data _null_;
2186    do x=0,1,.,123.456 ;
2187      c1=put(x,8.);
2188      c2=cats(x);
2189      put x= (c1 c2) (= :$quote.) ;
2190    end;
2191  run;

x=0 c1="       0" c2="0"
x=1 c1="       1" c2="1"
x= c1="" c2=""
x=123.456 c1="     123" c2="123.456"
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


2192  options missing=&amp;amp;save;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 15:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358260#M84162</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-12T15:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable missing values to character variable missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358279#M84166</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, chance is very slim, yet possible:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	input num;
	char=put(num,8.);
	char_1=ifc(num&amp;gt;.,put(num,8.),'');
	char_2=ifc(not missing(num),put(num,8.),'');
	cards;
100
.
._
.A
.Z
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 16:19:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-missing-values-to-character-variable/m-p/358279#M84166</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-05-12T16:19:51Z</dc:date>
    </item>
  </channel>
</rss>

