<?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: Remove numeric variable with a character value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560232#M156605</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99834"&gt;@Zerg&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset downloaded from CRSP and looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id&amp;nbsp; &amp;nbsp; date&amp;nbsp; &amp;nbsp; returns&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.5&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Returns is a numeric variable but somehow contains letters. Now I want to remove observations with letters or missing value in the returns. I can remove missing value observations with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
if not(ret=.); run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if I try to remove&amp;nbsp;observations with letters:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t2; set t;
if not(ret='B'); run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it prompts: Invalid numeric data, 'B'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I resolve this? Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would suggest searching the source to see if they have a description or possibly a format for what the special missing values represent. The actual meaning may have some impact on your specific use of the records.&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2019 17:26:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-20T17:26:09Z</dc:date>
    <item>
      <title>Remove numeric variable with a character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560225#M156598</link>
      <description>&lt;P&gt;I have a dataset downloaded from CRSP and looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; date&amp;nbsp; &amp;nbsp; returns&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.5&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returns is a numeric variable but somehow contains letters. Now I want to remove observations with letters or missing value in the returns. I can remove missing value observations with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
if not(ret=.); run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But if I try to remove&amp;nbsp;observations with letters:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t2; set t;
if not(ret='B'); run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it prompts: Invalid numeric data, 'B'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I resolve this? Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 17:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560225#M156598</guid>
      <dc:creator>Zerg</dc:creator>
      <dc:date>2019-05-20T17:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove numeric variable with a character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560226#M156599</link>
      <description>&lt;P&gt;Numeric variables cannot contain letters.&amp;nbsp; They can have special missing values which will be printed as the corresponding letter. SAS has 27 special missing values which in code you represent by a period followed by either a letter or underscore character.&amp;nbsp; So ._,.A,....,.Z.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a specific value then reference that value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  where returns = .C ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of if you want to include/exclude ALL missing values then use the MISSING() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  where not missing(returns);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 17:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560226#M156599</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-20T17:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Remove numeric variable with a character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560227#M156600</link>
      <description>&lt;P&gt;All non-numeric data will have resulted in missing values upon import, so removing observations with missing values should suffice.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 17:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560227#M156600</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-20T17:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove numeric variable with a character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560230#M156603</link>
      <description>&lt;P&gt;Thank you. Following you suggestion, I solved the issue by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
if not missing(ret); run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 May 2019 17:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560230#M156603</guid>
      <dc:creator>Zerg</dc:creator>
      <dc:date>2019-05-20T17:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Remove numeric variable with a character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560232#M156605</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99834"&gt;@Zerg&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset downloaded from CRSP and looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id&amp;nbsp; &amp;nbsp; date&amp;nbsp; &amp;nbsp; returns&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.2&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.5&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;xx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Returns is a numeric variable but somehow contains letters. Now I want to remove observations with letters or missing value in the returns. I can remove missing value observations with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
if not(ret=.); run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if I try to remove&amp;nbsp;observations with letters:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t2; set t;
if not(ret='B'); run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it prompts: Invalid numeric data, 'B'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I resolve this? Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would suggest searching the source to see if they have a description or possibly a format for what the special missing values represent. The actual meaning may have some impact on your specific use of the records.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 17:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-numeric-variable-with-a-character-value/m-p/560232#M156605</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-20T17:26:09Z</dc:date>
    </item>
  </channel>
</rss>

