<?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: Missing value in a SAS dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/478851#M31073</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I may put in my two cents:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;I would include the %GLOBAL and %LET statements in the macro, so that they are not forgotten.&lt;/LI&gt;
&lt;LI&gt;The data step will be very inefficient if the input dataset is huge and has a missing value in one of its first few observations. So, you'd better&amp;nbsp;stop checking for missing values as soon as one is found. This can be implemented in various ways. For example:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set &amp;amp;Path..&amp;amp;Name.;
if cmiss(of _all_) then do;
  call symputx('flag',1);
  stop;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
As you see, variable NM can be omitted if macro variable FLAG is the only result you need.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Tue, 17 Jul 2018 22:31:52 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2018-07-17T22:31:52Z</dc:date>
    <item>
      <title>Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477870#M31024</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found a lot of examples about missing values, either numerical or string but I did not find exactly what I am looking for.&lt;/P&gt;&lt;P&gt;I looking for something sample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset could contains a lot of observations and many variables of both kinds numerical and string.&lt;/P&gt;&lt;P&gt;So, I want to set a flag to one is there is no missing value (numerical or character) in the dataset and the flag to zero if there is some missing value without regards of the kind of values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone could have a nice idea?&lt;/P&gt;&lt;P&gt;I am using SAS EG 7.11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 14:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477870#M31024</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-07-13T14:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477873#M31025</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So, I want to set a flag to one is there is no missing value (numerical or character) in the dataset&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please clarify:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You want one flag for the entire data set?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or do you want a flag for each observation?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or do you want a flag for each variable?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 14:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477873#M31025</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-13T14:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477899#M31027</link>
      <description>&lt;P&gt;You can use arrays to find the missing Character and Numeric values and then assign the flag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines dlm=',' dsd missover;
input char1 $ char2 $ num1 num2;
datalines;
,char,1,
char,char,.,2
char,char,1,2
;
run;

data want (drop=i j);
set test;
array str(*) _character_;
array nbr(*) _numeric_;
do i=1 to dim(str);
if missing(str(i)) then flag=1;
end;
do j=1 to dim(nbr);
if missing(nbr(j)) then flag=1;
end;
if missing(flag) then flag=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477899#M31027</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-07-13T15:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477908#M31028</link>
      <description>&lt;P&gt;You can use functions available in SAS to help you with this as well, depending on what you are trying to accomplish.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;missing_flag = missing(VAR1); /* works for both numeric and character varaibles) */&lt;/P&gt;
&lt;P&gt;num_miss=nmiss(NUMVAR1, NUMVAR2, NUMVAR3);&lt;/P&gt;
&lt;P&gt;char_miss=cmiss(CHARVAR1, CHARVAR2, CARVAR3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477908#M31028</guid>
      <dc:creator>MelodieRush</dc:creator>
      <dc:date>2018-07-13T15:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477926#M31029</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already know those functions.&amp;nbsp; But how can we use those functions when we have around 100 variables.&lt;/P&gt;&lt;P&gt;I don't want to enter the name of each variable in the code...&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477926#M31029</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-07-13T15:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477927#M31030</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will say both.&lt;/P&gt;&lt;P&gt;First I am interested to check if there is a missing value in the dataset.&amp;nbsp; Then if so, which variable and observation?&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477927#M31030</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-07-13T15:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477942#M31032</link>
      <description>&lt;P&gt;If you want to check &lt;EM&gt;all&lt;/EM&gt; variables in the dataset, it's fairly simple:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
retain nm 0;
set sashelp.heart;
nm=cmiss(of _all_);
if nm;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This selects all observations with at least one missing value for further inspection and counts the missing values per observation in variable NM.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 16:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477942#M31032</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-13T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477943#M31033</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If you want to check &lt;EM&gt;all&lt;/EM&gt; variables in the dataset, it's fairly simple:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
retain nm 0;
set sashelp.heart;
nm=cmiss(of _all_);
if nm;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This selects all observations with at least one missing value for further inspection and counts the missing values per observation in variable NM.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that the new variable NM is included in the _ALL_ variable list.&amp;nbsp; This program handles that by using the RETAIN statement with an initial value to insure that NM is never missing.&amp;nbsp; You could also just subtract one from the result of the CMISS() function to account for the missing value of NM.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set sashelp.heart;
  nm=cmiss(of _all_) - 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jul 2018 16:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477943#M31033</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-13T16:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477978#M31036</link>
      <description>&lt;P&gt;You can certainly use arrays as suggested in other solutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array nums(*) _numeric_;&lt;/P&gt;
&lt;P&gt;array char(*) $ _character_:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And depending on how your dataset variables are named and arranged you can use short cuts like are described in this &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR1-VARn or if all your numeric or character are ordered together you can use the numvarfirst-numvarlast, etc...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so you could use nummissing = nmiss(VAR1-VAR100) instead of typing all the variable names.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 18:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/477978#M31036</guid>
      <dc:creator>MelodieRush</dc:creator>
      <dc:date>2018-07-13T18:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/478792#M31067</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I am interested to set a flag to one if there is at lease one missing value (num or string) in the dataset is there a better way to do that compare to my code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 19:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/478792#M31067</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-07-17T19:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Missing value in a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/478851#M31073</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I may put in my two cents:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;I would include the %GLOBAL and %LET statements in the macro, so that they are not forgotten.&lt;/LI&gt;
&lt;LI&gt;The data step will be very inefficient if the input dataset is huge and has a missing value in one of its first few observations. So, you'd better&amp;nbsp;stop checking for missing values as soon as one is found. This can be implemented in various ways. For example:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set &amp;amp;Path..&amp;amp;Name.;
if cmiss(of _all_) then do;
  call symputx('flag',1);
  stop;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
As you see, variable NM can be omitted if macro variable FLAG is the only result you need.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 17 Jul 2018 22:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Missing-value-in-a-SAS-dataset/m-p/478851#M31073</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-17T22:31:52Z</dc:date>
    </item>
  </channel>
</rss>

