<?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 to missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608094#M176922</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi! I'm a little confused about the question below and not sure how to code it. Any input is greatly appreciated. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A sas dataset has the following values for its 35 numeric variables:&lt;/P&gt;
&lt;P&gt;99 Do not know&lt;/P&gt;
&lt;P&gt;98 Refused to answer&lt;/P&gt;
&lt;P&gt;97 Skipped question&lt;/P&gt;
&lt;P&gt;Write the data step statement to convert these values to the standard sas missing value (.)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's an example you can run based on the CLASS data set. I prefer to use CALL MISSING to set values to missing because it works the same for numeric and character variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on what you've been studying so far, if this is homework, you may need to use the approach taught in class rather than what I've posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
set sashelp.class;

if age in (12, 13, 14) then call missing(age);



*if age=12 or age=13 or age=14 then age = . ;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 Nov 2019 17:19:34 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-11-28T17:19:34Z</dc:date>
    <item>
      <title>convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608089#M176919</link>
      <description>&lt;P&gt;Hi! I'm a little confused about the question below and not sure how to code it. Any input is greatly appreciated. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A sas dataset has the following values for its 35 numeric variables:&lt;/P&gt;
&lt;P&gt;99 Do not know&lt;/P&gt;
&lt;P&gt;98 Refused to answer&lt;/P&gt;
&lt;P&gt;97 Skipped question&lt;/P&gt;
&lt;P&gt;Write the data step statement to convert these values to the standard sas missing value (.)&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 17:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608089#M176919</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-11-28T17:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608094#M176922</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi! I'm a little confused about the question below and not sure how to code it. Any input is greatly appreciated. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A sas dataset has the following values for its 35 numeric variables:&lt;/P&gt;
&lt;P&gt;99 Do not know&lt;/P&gt;
&lt;P&gt;98 Refused to answer&lt;/P&gt;
&lt;P&gt;97 Skipped question&lt;/P&gt;
&lt;P&gt;Write the data step statement to convert these values to the standard sas missing value (.)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's an example you can run based on the CLASS data set. I prefer to use CALL MISSING to set values to missing because it works the same for numeric and character variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on what you've been studying so far, if this is homework, you may need to use the approach taught in class rather than what I've posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
set sashelp.class;

if age in (12, 13, 14) then call missing(age);



*if age=12 or age=13 or age=14 then age = . ;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Nov 2019 17:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608094#M176922</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-28T17:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608095#M176923</link>
      <description>Thank you very much for your kind help! I greatly appreciate it!</description>
      <pubDate>Thu, 28 Nov 2019 17:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608095#M176923</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-11-28T17:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608158#M176952</link>
      <description>&lt;P&gt;Does this answer look right? I'm not sure what I need to do with 35 numeric variables.&lt;/P&gt;
&lt;PRE&gt;Data zz;
input x response $18.;
cards;
99 Do not know
98 Refused to answer
97 Skipped question
;
run;
proc print;
run;

data zz1;
set zz;
if x in (99, 98, 97) then call missing(x);
run;
proc print;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Nov 2019 02:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608158#M176952</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-11-29T02:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608162#M176955</link>
      <description>&lt;P&gt;A good way to do the same thing for more than one variable is to use an array.&amp;nbsp; Did you learn how to use an array?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 04:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608162#M176955</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-29T04:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: convert numeric variable to missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608163#M176956</link>
      <description>Yes, I'll try this again using array. Thank you so much!</description>
      <pubDate>Fri, 29 Nov 2019 04:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-numeric-variable-to-missing/m-p/608163#M176956</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-11-29T04:27:04Z</dc:date>
    </item>
  </channel>
</rss>

