<?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 missing value shows a dot in a character variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798779#M314014</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;please could you help me to understand this because my head is gonna exploted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I create the next have dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input pulse $ pulsen;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;80.0 80.0&lt;/P&gt;
&lt;P&gt;90.0 90.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;lenght pulsechar pulsechar2 $20.;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;pulsechar=strip(input(pulsen,best.)); convert a numeric variable to character variable;&lt;/P&gt;
&lt;P&gt;pulsechar2=pulse;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue i have is:&lt;/P&gt;
&lt;P&gt;even SAS show me pulsechar as a character variable,&lt;/P&gt;
&lt;P&gt;the missing value numeric .&lt;/P&gt;
&lt;P&gt;is not converted to a blank value, the dot is remaining there,&lt;/P&gt;
&lt;P&gt;and i found it very annoying, because pulsechar is not a real character value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that conversion numeric to character pulsechar=strip(input(pulsen,best.)); no strictly&amp;nbsp; speaking&lt;/P&gt;
&lt;P&gt;a real conversion from numeric to character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help to make pulsechar (show the blank value as a dot) exactly the same than pulsechar2 (show the blank value)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cuan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Feb 2022 00:26:35 GMT</pubDate>
    <dc:creator>cuan</dc:creator>
    <dc:date>2022-02-26T00:26:35Z</dc:date>
    <item>
      <title>missing value shows a dot in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798779#M314014</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;please could you help me to understand this because my head is gonna exploted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I create the next have dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input pulse $ pulsen;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;80.0 80.0&lt;/P&gt;
&lt;P&gt;90.0 90.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;lenght pulsechar pulsechar2 $20.;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;pulsechar=strip(input(pulsen,best.)); convert a numeric variable to character variable;&lt;/P&gt;
&lt;P&gt;pulsechar2=pulse;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue i have is:&lt;/P&gt;
&lt;P&gt;even SAS show me pulsechar as a character variable,&lt;/P&gt;
&lt;P&gt;the missing value numeric .&lt;/P&gt;
&lt;P&gt;is not converted to a blank value, the dot is remaining there,&lt;/P&gt;
&lt;P&gt;and i found it very annoying, because pulsechar is not a real character value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that conversion numeric to character pulsechar=strip(input(pulsen,best.)); no strictly&amp;nbsp; speaking&lt;/P&gt;
&lt;P&gt;a real conversion from numeric to character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help to make pulsechar (show the blank value as a dot) exactly the same than pulsechar2 (show the blank value)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cuan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 00:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798779#M314014</guid>
      <dc:creator>cuan</dc:creator>
      <dc:date>2022-02-26T00:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: missing value shows a dot in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798781#M314015</link>
      <description>sorry pulsechar=strip(put(pulsen,best.)); but still not make the missing value as a blank, the dot still there.</description>
      <pubDate>Sat, 26 Feb 2022 00:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798781#M314015</guid>
      <dc:creator>cuan</dc:creator>
      <dc:date>2022-02-26T00:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: missing value shows a dot in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798782#M314016</link>
      <description>&lt;P&gt;I think you are looking for the MISSING option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some test code that shows two ways to convert a number into a character string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input num ;
  char1 = put(num,best12.);
  char2 = cats(num);
cards;
1
-1
.
1.5
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that results in this output:&lt;/P&gt;
&lt;PRE&gt;Obs     num    char1    char2

 1      1.0       1      1
 2     -1.0      -1      -1
 3       .        .      .
 4      1.5     1.5      1.5
&lt;/PRE&gt;
&lt;P&gt;But if you first change the MISSING option to a space instead of period:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=' ';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then run the same code you get this instead:&lt;/P&gt;
&lt;PRE&gt;Obs     num    char1    char2

 1      1.0       1      1
 2     -1.0      -1      -1
 3
 4      1.5     1.5      1.5
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not clear to me where you think your code is converting numbers to characters.&amp;nbsp; The only EXPLICIT conversion you have is an INPUT() function, which must read from a character variable so is obviously not for converting numbers into anything. Plus it is a little strange to use BEST as an informat, but SAS is forgiving and will treat BEST as an alias for the normal numeric informat.&amp;nbsp;&amp;nbsp;The idea of the BEST format is to find the best way to represent the given number as a string of the specified length.&amp;nbsp; That concept doesn't really translate to informats.&amp;nbsp; There isn't any best way to represent a number as a number, there is only one way to represent any number as a number.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 00:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798782#M314016</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-26T00:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: missing value shows a dot in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798783#M314017</link>
      <description>i found this solution in this forum:&lt;BR /&gt;if pulsen &amp;gt; . then pulsechar=strip(put(pulsen,best.));&lt;BR /&gt;&lt;BR /&gt;now you get the blank value in the pulsechar charcater variable.</description>
      <pubDate>Sat, 26 Feb 2022 00:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798783#M314017</guid>
      <dc:creator>cuan</dc:creator>
      <dc:date>2022-02-26T00:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: missing value shows a dot in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798785#M314018</link>
      <description>thank you very much for your great explanation, sorry i forget , it was a mistake, i mean PUT instead of INPUT.</description>
      <pubDate>Sat, 26 Feb 2022 00:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/missing-value-shows-a-dot-in-a-character-variable/m-p/798785#M314018</guid>
      <dc:creator>cuan</dc:creator>
      <dc:date>2022-02-26T00:49:30Z</dc:date>
    </item>
  </channel>
</rss>

