<?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 variable that takes character values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450691#M113512</link>
    <description>&lt;P&gt;1. Make sure it was imported correctly - so it would need to be a character variable. If it's not, then you've already lost that information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is numeric and is showing values of B/C that likely means you're using a format on that variable or special missing values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if this is the case, then try if Ret = .C&amp;nbsp; or if missing(RET)&lt;/P&gt;</description>
    <pubDate>Tue, 03 Apr 2018 15:05:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-03T15:05:41Z</dc:date>
    <item>
      <title>Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450678#M113504</link>
      <description>&lt;P&gt;I have a CRSP dataset and one of the variables (RET) is RETURN which has a numeric format 11.6. However, there are observations that has&amp;nbsp;character values( B and C character) for this variable ( which does not make sense). I cannot query to&amp;nbsp;choose or remove these observations. I have tried " if Ret = 'C' then .... " and if Ret = C then ....." and don't. Is there a way to work around this?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 14:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450678#M113504</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2018-04-03T14:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450684#M113508</link>
      <description>&lt;P&gt;Check out the properties for the dataset, is it telling you that variable is really numeric?&amp;nbsp; If so then:&lt;/P&gt;
&lt;PRE&gt;where not missing(ret)...&lt;/PRE&gt;
&lt;P&gt;Should work.&amp;nbsp; If it is character, then what you have should work.&amp;nbsp; If its got a format applied then check out what the format is.&amp;nbsp; Really hard for me to guess without any information.&amp;nbsp; Use this post to show some test data:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 15:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450684#M113508</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-03T15:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450691#M113512</link>
      <description>&lt;P&gt;1. Make sure it was imported correctly - so it would need to be a character variable. If it's not, then you've already lost that information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is numeric and is showing values of B/C that likely means you're using a format on that variable or special missing values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if this is the case, then try if Ret = .C&amp;nbsp; or if missing(RET)&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 15:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450691#M113512</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-03T15:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450701#M113515</link>
      <description>&lt;P&gt;Check the data set properties to see what the actual format assigned is. If it is actually numeric someone may have assigned SAS special missing values. In some views they special value shows but is excluded for calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input numeric;
datalines;
1
2
.
.B
;
run;

Proc freq;run;
proc print;run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Apr 2018 15:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450701#M113515</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-03T15:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450734#M113534</link>
      <description>&lt;P&gt;Have you done any research into why you see a "B" or&amp;nbsp;"C" in a supposedly numeric field?&amp;nbsp; That might be important to know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, you will likely need RET to be numeric.&amp;nbsp; If you can see a "B" or a "C", it's likely character.&amp;nbsp; (If&amp;nbsp;you are seeing "B" or "C" after using PROC IMPORT, a common tool with CRSP data, then it's definitely character.&amp;nbsp; But PROC CONTENTS will confirm that.)&amp;nbsp; So you will need to do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;ret_numeric = input(ret, ??10.);&lt;/P&gt;
&lt;P&gt;if ret_numeric = . then delete;&lt;/P&gt;
&lt;P&gt;drop ret;&lt;/P&gt;
&lt;P&gt;rename ret_numeric = ret;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 16:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450734#M113534</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-03T16:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450778#M113550</link>
      <description>&lt;P&gt;i used to download CRSP data in CSV format and then import it. But this time, I chose the dataset tobe in SAS dataset format and hence the issue. It turns out missing value can take other values too, not just "." so in this case it is .B and .C&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 18:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450778#M113550</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2018-04-03T18:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450779#M113551</link>
      <description>&lt;P&gt;This works. thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 18:16:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450779#M113551</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2018-04-03T18:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable that takes character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450782#M113554</link>
      <description>&lt;P&gt;So these are the special missing values I mentioned earlier, you will likely find some notes in the documentation on what they mean specifically, ie .B may mean no answer and .C may mean not asked (I made those up, check the docs!).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 18:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-that-takes-character-values/m-p/450782#M113554</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-03T18:17:43Z</dc:date>
    </item>
  </channel>
</rss>

