<?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 variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359669#M84591</link>
    <description>Hi Art,&lt;BR /&gt;Thanks for the code, unfortunately I have a data set with lots of numeric&lt;BR /&gt;and character variables, is there a way to include all of them in the code?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is what I intent to get:&lt;BR /&gt;&lt;BR /&gt;I have:&lt;BR /&gt;id young home tree garden garage livingroom&lt;BR /&gt;1 2 8 yes 4 8&lt;BR /&gt;2 4 6 no&lt;BR /&gt;3 yes 8 8 4 1 7&lt;BR /&gt;4 yes 9 1 5&lt;BR /&gt;5 7 5 0 7 2 3&lt;BR /&gt;6 8 no 4 5 9&lt;BR /&gt;7 3 4 7 7 7&lt;BR /&gt;8 7 8 8&lt;BR /&gt;9 5 no 8 9&lt;BR /&gt;10 8 6 4 7 no 10&lt;BR /&gt;Would like to have:&lt;BR /&gt;Id deriver_var&lt;BR /&gt;1 garage&lt;BR /&gt;2 home garden livingroom&lt;BR /&gt;4 garden livingroom&lt;BR /&gt;6 home&lt;BR /&gt;7 young&lt;BR /&gt;8 young garden livingroom&lt;BR /&gt;9 tree garage&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Ed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
    <pubDate>Thu, 18 May 2017 14:59:32 GMT</pubDate>
    <dc:creator>lalohg</dc:creator>
    <dc:date>2017-05-18T14:59:32Z</dc:date>
    <item>
      <title>Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359239#M84482</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;How can i get the name of all missing variables raw by raw. thx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var1 &amp;nbsp; var2 &amp;nbsp; var3 &amp;nbsp; var4 &amp;nbsp; &amp;nbsp;deriver_var &amp;nbsp;&lt;/P&gt;&lt;P&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; var1&lt;/P&gt;&lt;P&gt;2 &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;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; var2 var3&lt;/P&gt;&lt;P&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;. &amp;nbsp; &amp;nbsp; &amp;nbsp; var1 var2 var4&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 00:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359239#M84482</guid>
      <dc:creator>Raffik</dc:creator>
      <dc:date>2017-05-17T00:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359241#M84483</link>
      <description>&lt;PRE&gt;data want;
  set have;
  length deriver_var $50;
  array vars(*) var1-var4;
  do _n_=1 to dim(vars);
    if missing(vars(_n_)) then do;
      deriver_var=catx(' ',deriver_var,vname(vars(_n_)));
    end;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 01:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359241#M84483</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-17T01:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359247#M84484</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 02:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359247#M84484</guid>
      <dc:creator>Raffik</dc:creator>
      <dc:date>2017-05-17T02:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359262#M84489</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/102102"&gt;@Raffik&lt;/a&gt;&amp;nbsp;Please mark &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;'s solution as accepted and answered. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 06:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359262#M84489</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-05-17T06:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359632#M84580</link>
      <description>&lt;P&gt;Dear Art,&lt;/P&gt;
&lt;P&gt;how can I modify the code to get the deriver_var in a data set with several numeric and character variables like the attached example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;all your help will be appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Ed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 12:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359632#M84580</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2017-05-18T12:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359666#M84590</link>
      <description>&lt;P&gt;I was unable to view your workbook, but here is one way to include both character and numeric variables:&lt;/P&gt;
&lt;PRE&gt;data class;
  set sashelp.class;
  if _n_ in (2,8) then do;
    call missing(age);
    call missing(sex);
    call missing(weight);
  end;
run;

data want;
  set class;
  length deriver_var $50;
  array cvars(*) name sex;
  array nvars(*) age height weight;
  do _n_=1 to dim(cvars);
    if missing(cvars(_n_)) then do;
      deriver_var=catx(' ',deriver_var,vname(cvars(_n_)));
    end;
  end;
  do _n_=1 to dim(nvars);
    if missing(nvars(_n_)) then do;
      deriver_var=catx(' ',deriver_var,vname(nvars(_n_)));
    end;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;You could specify the numeric variables with _numeric_ rather than spelling them out. Unfortunately, you can't do the same with the character variables as deriver_var will be included in the list of character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 14:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359666#M84590</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-18T14:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359669#M84591</link>
      <description>Hi Art,&lt;BR /&gt;Thanks for the code, unfortunately I have a data set with lots of numeric&lt;BR /&gt;and character variables, is there a way to include all of them in the code?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is what I intent to get:&lt;BR /&gt;&lt;BR /&gt;I have:&lt;BR /&gt;id young home tree garden garage livingroom&lt;BR /&gt;1 2 8 yes 4 8&lt;BR /&gt;2 4 6 no&lt;BR /&gt;3 yes 8 8 4 1 7&lt;BR /&gt;4 yes 9 1 5&lt;BR /&gt;5 7 5 0 7 2 3&lt;BR /&gt;6 8 no 4 5 9&lt;BR /&gt;7 3 4 7 7 7&lt;BR /&gt;8 7 8 8&lt;BR /&gt;9 5 no 8 9&lt;BR /&gt;10 8 6 4 7 no 10&lt;BR /&gt;Would like to have:&lt;BR /&gt;Id deriver_var&lt;BR /&gt;1 garage&lt;BR /&gt;2 home garden livingroom&lt;BR /&gt;4 garden livingroom&lt;BR /&gt;6 home&lt;BR /&gt;7 young&lt;BR /&gt;8 young garden livingroom&lt;BR /&gt;9 tree garage&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Ed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Thu, 18 May 2017 14:59:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359669#M84591</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2017-05-18T14:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Missing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359673#M84592</link>
      <description>&lt;P&gt;You could use _character_ and just exclude the new variable from the check. e.g.:&lt;/P&gt;
&lt;PRE&gt;data class;
  set sashelp.class;
  if _n_ in (2,8) then do;
    call missing(age);
    call missing(sex);
    call missing(weight);
  end;
run;

data want;
  set class;
  length deriver_var $50;
  array cvars(*) _character_;
  array nvars(*) _numeric_;
  do _n_=1 to dim(cvars);
    if vname(cvars(_n_)) ne 'deriver_var' and missing(cvars(_n_)) then do;
      deriver_var=catx(' ',deriver_var,vname(cvars(_n_)));
    end;
  end;
  do _n_=1 to dim(nvars);
    if missing(nvars(_n_)) then do;
      deriver_var=catx(' ',deriver_var,vname(nvars(_n_)));
    end;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 15:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-variables/m-p/359673#M84592</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-18T15:05:22Z</dc:date>
    </item>
  </channel>
</rss>

