<?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 from numeric to character with special characters in number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914571#M360392</link>
    <description>&lt;P&gt;Do not convert it into character, better apply format pvalue6.4 which displays the value as expected&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; &lt;BR /&gt;set have;
format probF pvalue6.4;&lt;BR /&gt;run;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Feb 2024 20:29:47 GMT</pubDate>
    <dc:creator>A_Kh</dc:creator>
    <dc:date>2024-02-05T20:29:47Z</dc:date>
    <item>
      <title>Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914502#M360360</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, how do you convert a variable type number to character when some values include special characters such &amp;lt;? e.g., p_value=&amp;lt;.0001.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 14:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914502#M360360</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2024-02-05T14:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914506#M360361</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Hi, how do you convert a variable type number to character when some values include special characters such &amp;lt;? e.g., p_value=&amp;lt;.0001.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you mix up the direction of the conversion?&amp;nbsp; If the value is numeric it cannot have any special characters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So assuming you want to convert a character string to a number you will have to decide what to do with extra characters.&amp;nbsp; Do you just want to remove them?&lt;/P&gt;
&lt;P&gt;So you could remove specific characters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numvar = input(compress(charvar,'&amp;lt;'),32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or only keep digits and normal punctuation.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numvar = input(compress(charvar,'+-.','kd'),32.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 14:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914506#M360361</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-05T14:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914510#M360362</link>
      <description>Hi, the variable comes from an output after running proc glmm. I am getting the output to create a table with results. The output specifies ProbF as a numeric variable. Some of the values are &amp;lt;.0001. The issue is that if I leave the type as numeric I get the actual number e.g., 0.000054 instead of the convention of reporting a pvalue as &amp;lt;0.0001.</description>
      <pubDate>Mon, 05 Feb 2024 15:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914510#M360362</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2024-02-05T15:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914517#M360365</link>
      <description>The values like &amp;lt; .0001 are already numeric.  They are printing using a format that includes a less than sign for small values.&lt;BR /&gt;&lt;BR /&gt;One choice you have is to remove the format before printing:&lt;BR /&gt;format var;&lt;BR /&gt;&lt;BR /&gt;Another choice you have is to change the data:&lt;BR /&gt;if var &amp;lt; .0001 then var = .0001;&lt;BR /&gt;Does that make sense?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914517#M360365</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-02-05T15:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914519#M360367</link>
      <description>&lt;P&gt;In that case just do it yourself.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if not missing(numvar) then do;
  if numvar &amp;gt;= 0.0001 then charvar=put(numvar,7.4);
  else charvar='&amp;lt;0.0001';
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914519#M360367</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-05T15:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914520#M360368</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914520#M360368</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2024-02-05T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914521#M360369</link>
      <description>Thank you!</description>
      <pubDate>Mon, 05 Feb 2024 15:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914521#M360369</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2024-02-05T15:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914524#M360371</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi, the variable comes from an output after running proc glmm. I am getting the output to create a table with results. The output specifies ProbF as a numeric variable. Some of the values are &amp;lt;.0001. The issue is that if I leave the type as numeric I get the actual number e.g., 0.000054 instead of the convention of reporting a pvalue as &amp;lt;0.0001.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the formatted value with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p06uh7sqlh94nxn1gezyms3e9njn.htm" target="_blank" rel="noopener"&gt;VVALUE function&lt;/A&gt;, even without knowing the format. You should specify a reasonable length, though:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
length char_ProbF $8;
char_ProbF=vvalue(ProbF);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914524#M360371</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-02-05T15:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from numeric to character with special characters in number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914571#M360392</link>
      <description>&lt;P&gt;Do not convert it into character, better apply format pvalue6.4 which displays the value as expected&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; &lt;BR /&gt;set have;
format probF pvalue6.4;&lt;BR /&gt;run;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 20:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-from-numeric-to-character-with-special-characters-in/m-p/914571#M360392</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2024-02-05T20:29:47Z</dc:date>
    </item>
  </channel>
</rss>

