<?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: report missing variable with comment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682314#M206528</link>
    <description>&lt;P&gt;data want ; set have;&lt;BR /&gt;if missing(number) &amp;gt; 0 then comment=" Number variable is missing" ;&lt;BR /&gt;if (missing(results) &amp;gt; 0) and (missing(rank) &amp;gt; 0 )&lt;BR /&gt;then comment="Results and rank variable is missing" ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;And so on for what ever other combinations of missing variables you'd like to identify&lt;/P&gt;</description>
    <pubDate>Tue, 08 Sep 2020 17:07:41 GMT</pubDate>
    <dc:creator>rmacarthur</dc:creator>
    <dc:date>2020-09-08T17:07:41Z</dc:date>
    <item>
      <title>report missing variable with comment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682300#M206523</link>
      <description>&lt;P&gt;Hi I have a datasets having numerous variables&amp;nbsp;and want to compare what are the variables having missing values for a subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id name number results rank&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; Nan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; Ben&amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want results like with new variable "Comment"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id name number results rank&amp;nbsp; &amp;nbsp;Comment&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; Nan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; Number variable is missing&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; Ben&amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Results and rank variable is missing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 17:06:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682300#M206523</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2020-09-08T17:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: report missing variable with comment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682314#M206528</link>
      <description>&lt;P&gt;data want ; set have;&lt;BR /&gt;if missing(number) &amp;gt; 0 then comment=" Number variable is missing" ;&lt;BR /&gt;if (missing(results) &amp;gt; 0) and (missing(rank) &amp;gt; 0 )&lt;BR /&gt;then comment="Results and rank variable is missing" ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;And so on for what ever other combinations of missing variables you'd like to identify&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 17:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682314#M206528</guid>
      <dc:creator>rmacarthur</dc:creator>
      <dc:date>2020-09-08T17:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: report missing variable with comment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682325#M206532</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327170"&gt;@Aexor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi I have a datasets having numerous variables&amp;nbsp;and want to compare what are the variables having missing values for a subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id name number results rank&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; Nan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; Ben&amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want results like with new variable "Comment"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id name number results rank&amp;nbsp; &amp;nbsp;Comment&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; Nan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; Number variable is missing&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; Ben&amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Results and rank variable is missing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I wouldn't bother to try much of an actual narrative sentence because you have potential several different rules to use.&lt;/P&gt;
&lt;P&gt;I might start with something like:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array _nums_ _numeric_;
   array _chars_  _character_;
   length comment $200; /* the length 
   of the comment variable has to be long
   enough to contain the names of ALL the variables
   in your data set + one space to separate them
   PLUS any miscellaneous text
   */
   comment='Vars with missing values are: ';
   do i=1 to dim(_nums_);
      if missing(_nums_[i]) then comment=catx(' ',comment,vname(_nums_[i]));
   end;
   do i=1 to dim(_chars_);
      if missing(_chars_[i]) then comment=catx(' ',comment,vname(_chars_[i]));
   end;
   drop i;
&lt;/PRE&gt;
&lt;P&gt;The VNAME function can return the name of an Array referenced variable. The _numeric_ and _character_ are special words to provide access to those types of variables. DO NOT define COMMENT prior to the Array statement or it would be included in the checks for the character variables.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 17:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/report-missing-variable-with-comment/m-p/682325#M206532</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-08T17:17:24Z</dc:date>
    </item>
  </channel>
</rss>

