<?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: Code to find missing values in all variables of an observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25725#M4496</link>
    <description>Hi Peter,&lt;BR /&gt;
&lt;BR /&gt;
Yes, that was one way.&lt;BR /&gt;
&lt;BR /&gt;
But the function cats didnt accept it's arguments in this way. The arguement "of _character_" resulted in an error asking for enough arguments.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
MSG</description>
    <pubDate>Fri, 04 Dec 2009 10:46:44 GMT</pubDate>
    <dc:creator>msg</dc:creator>
    <dc:date>2009-12-04T10:46:44Z</dc:date>
    <item>
      <title>Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25721#M4492</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I have got a requirement like this.&lt;BR /&gt;
&lt;BR /&gt;
I have to delete all observations which has missing values in all variables; irrespective of the datatype. This should be accomplished in a data step in a single statement, without using macro.&lt;BR /&gt;
 &lt;BR /&gt;
I tried with _all_. But, i guess The SAS System never allows this to be assigned to a variable. I also tried with cmiss &amp;amp; nmiss, but these 2 functions are specific to datatype. I tried with sum function which will throw a "invalid numeric data" note when character variable is encountered.&lt;BR /&gt;
&lt;BR /&gt;
Help me if you know any logic.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
MSG</description>
      <pubDate>Fri, 04 Dec 2009 06:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25721#M4492</guid>
      <dc:creator>msg</dc:creator>
      <dc:date>2009-12-04T06:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25722#M4493</link>
      <description>Yes, you can declare an ARRAY using the _ALL_ operand for the variable name and then test using the MISSING function in a DO / END loop.  If all variables have a missing condition, then DELETE the observation.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 04 Dec 2009 07:43:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25722#M4493</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-04T07:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25723#M4494</link>
      <description>Thanks SBB for your response.&lt;BR /&gt;
&lt;BR /&gt;
Yes, i tried implementing with an array. But, our array will accept only variables of the same datatype. So, i will not be able to define an array for this situation.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
MSG</description>
      <pubDate>Fri, 04 Dec 2009 08:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25723#M4494</guid>
      <dc:creator>msg</dc:creator>
      <dc:date>2009-12-04T08:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25724#M4495</link>
      <description>no array required.&lt;BR /&gt;
Rather than re-write all your table, you can update-in-place with the modify statement and remove rows where the count of non-missing numerics is zero and the concatenation of all character columns is blank with:&lt;BR /&gt;
data  your.data ;&lt;BR /&gt;
   modify your.data ;&lt;BR /&gt;
   if   n( of _numeric_ ) = 0  and cats( of _character_ ) = ' ' then remove ;&lt;BR /&gt;
run ;&lt;BR /&gt;
Does this do what is needed?&lt;BR /&gt;
The data step creating a new table with the missing obs deleted is very similar&lt;BR /&gt;
(a new dataset name in the data statement, replace "modify" with "set", and "remove" with "delete")&lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 04 Dec 2009 10:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25724#M4495</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-04T10:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25725#M4496</link>
      <description>Hi Peter,&lt;BR /&gt;
&lt;BR /&gt;
Yes, that was one way.&lt;BR /&gt;
&lt;BR /&gt;
But the function cats didnt accept it's arguments in this way. The arguement "of _character_" resulted in an error asking for enough arguments.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
MSG</description>
      <pubDate>Fri, 04 Dec 2009 10:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25725#M4496</guid>
      <dc:creator>msg</dc:creator>
      <dc:date>2009-12-04T10:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25726#M4497</link>
      <description>that systax error occurs when there are no character variables, and you indicated that _all_ involved more than one data type implying that there are character variables in that test case.&lt;BR /&gt;
The solution only requires a small extension to that use of cats()&lt;BR /&gt;
   and cats( of _character_, ' ' ) &lt;BR /&gt;
Perhaps there needs to be a similar alteration to the use of the N() function&lt;BR /&gt;
   n( of _numeric_, . )</description>
      <pubDate>Fri, 04 Dec 2009 12:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25726#M4497</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-04T12:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25727#M4498</link>
      <description>Thanks Peter &amp;amp; SBB for your responses.</description>
      <pubDate>Fri, 04 Dec 2009 12:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25727#M4498</guid>
      <dc:creator>msg</dc:creator>
      <dc:date>2009-12-04T12:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25728#M4499</link>
      <description>Cat will take numerics so use:&lt;BR /&gt;
if compress(cat(of _all_, ". ")) = '' then delete;</description>
      <pubDate>Fri, 04 Dec 2009 13:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25728#M4499</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-04T13:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25729#M4500</link>
      <description>Yes CAT does accept numerics but the technique won't work if the numerics have special missing values.  Better to stick with Peter's suggestion.&lt;BR /&gt;
&lt;BR /&gt;
OBS 4 below has all missing variable as does OBS 3.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
   missing a b;&lt;BR /&gt;
   input a$ b c$ d e f;&lt;BR /&gt;
   *if compress(cats(of _all_), ". ")  eq  ' ' then flag=1;&lt;BR /&gt;
   if n(of _numeric_,.) eq 0 and cats(of _character_,' ') eq ' ' then flag=1;&lt;BR /&gt;
   cards;&lt;BR /&gt;
a b c 1 2 3&lt;BR /&gt;
2 a c 1 2 3&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
. a . a b b&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 04 Dec 2009 14:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25729#M4500</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-12-04T14:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code to find missing values in all variables of an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25730#M4501</link>
      <description>Sorry about the incorrect ARRAY info - yes, it is sensitive to SAS variable-type, so two arrays are necessary, as illustrated below:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
retain a1-a5 ' ' n1-n5 0;&lt;BR /&gt;
array allnvars (*) _numeric_;&lt;BR /&gt;
array allcvars (*) _character_;&lt;BR /&gt;
do i=1 to dim(allnvars);&lt;BR /&gt;
  putlog allnvars(i)= ;&lt;BR /&gt;
end;&lt;BR /&gt;
do i=1 to dim(allcvars);&lt;BR /&gt;
  putlog allcvars(i)= ;&lt;BR /&gt;
end;&lt;BR /&gt;
stop;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Also, I find the other alternatives to be good choices as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 04 Dec 2009 15:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-find-missing-values-in-all-variables-of-an-observation/m-p/25730#M4501</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-04T15:59:42Z</dc:date>
    </item>
  </channel>
</rss>

