<?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: Identifying missing data values in data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669800#M23229</link>
    <description>&lt;P&gt;If the first place you reference the variable is when you are assigning it a numeric value then the variable will defined as numeric.&amp;nbsp; So define the variable BEFORE using it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length chol_status $20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also&amp;nbsp;you told it to set the missing value to Safe with this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if cholesterol&amp;lt;200 then chol_status="Safe";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will consider any of the 28 missing values that SAS supports as less than any valid value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably meant to have another ELSE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(cholesterol) then chol_status=' ';
else if cholesterol &amp;lt; 200 then chol_status='Safe';
else if cholesterol &amp;lt;=239 then chol_status='High-Borderline';
else if cholesterol &amp;gt;=240 then chol_status='High';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2020 04:18:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-07-16T04:18:31Z</dc:date>
    <item>
      <title>Identifying missing data values in data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669796#M23228</link>
      <description>&lt;OL&gt;&lt;LI&gt;For the missing values in cholesterol. The code is not working for the output variable chol_status. Each time I run the code the output variable chol_status displays “Safe” instead of a blank space.&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;To identify missing values I thought you used:&amp;nbsp; if variable-name=. then variable-name=. ; &amp;nbsp;&amp;nbsp;or&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if missing(variable-name) then variable-name=. ;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What would be the correct code for missing values for ?&lt;/P&gt;&lt;PRE&gt;data results;&lt;BR /&gt;	set "/home/u44696116/TheCut/input/input44.sas7bdat";&lt;BR /&gt;	length chol_status $ 15;&lt;BR /&gt;	drop bp_status weight_status smoking_status;&lt;BR /&gt;	&lt;FONT color="#FF0000"&gt;if cholesterol=. then chol_status=. ;&lt;/FONT&gt;&lt;BR /&gt;			if cholesterol&amp;lt;200 then chol_status="Safe";&lt;BR /&gt;			else if cholesterol&amp;lt;=239 then chol_status="High-Borderline";&lt;BR /&gt;			else if cholesterol&amp;gt;=240 then chol_status="High";		&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;SAS ANSWER&lt;/P&gt;&lt;PRE&gt;data out;&lt;BR /&gt;	set "/home/u44696116/TheCut/input/input44.sas7bdat";&lt;BR /&gt;	length chol_status $ 15;&lt;BR /&gt;	drop bp_status weight_status smoking_status;&lt;BR /&gt;	&lt;FONT color="#00FF00"&gt;if cholesterol ne . then do;&lt;/FONT&gt;&lt;BR /&gt;	                if cholesterol &amp;lt; 200 then chol_status='Safe';&lt;BR /&gt;			else if cholesterol &amp;lt;=239 then chol_status='High-Borderline';&lt;BR /&gt;			else if cholesterol &amp;gt;=240 then chol_status='High';&lt;BR /&gt;		end;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 03:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669796#M23228</guid>
      <dc:creator>armoore</dc:creator>
      <dc:date>2020-07-16T03:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying missing data values in data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669800#M23229</link>
      <description>&lt;P&gt;If the first place you reference the variable is when you are assigning it a numeric value then the variable will defined as numeric.&amp;nbsp; So define the variable BEFORE using it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length chol_status $20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also&amp;nbsp;you told it to set the missing value to Safe with this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if cholesterol&amp;lt;200 then chol_status="Safe";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will consider any of the 28 missing values that SAS supports as less than any valid value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably meant to have another ELSE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(cholesterol) then chol_status=' ';
else if cholesterol &amp;lt; 200 then chol_status='Safe';
else if cholesterol &amp;lt;=239 then chol_status='High-Borderline';
else if cholesterol &amp;gt;=240 then chol_status='High';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 04:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669800#M23229</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-16T04:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying missing data values in data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669818#M23233</link>
      <description>&lt;P&gt;Alternatively you can try the proc format as below, for this you need to create a format and then use that format to derive a new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, use the libname to call the dataset in the set statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value chol
low-&amp;lt;200='Safe'
200-239='High-Borderline'
240-high='High'
other=' ';
run;

libname dat "/home/u44696116/TheCut/input";

data out;
	length chol_status $ 15;
	set dat.input44;
	drop bp_status weight_status smoking_status;
    chol_status=put(cholesterol,chol.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 07:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/669818#M23233</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-07-16T07:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying missing data values in data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/670050#M23264</link>
      <description>Thank you</description>
      <pubDate>Fri, 17 Jul 2020 04:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identifying-missing-data-values-in-data-set/m-p/670050#M23264</guid>
      <dc:creator>armoore</dc:creator>
      <dc:date>2020-07-17T04:31:10Z</dc:date>
    </item>
  </channel>
</rss>

