<?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: SAS OUTPUT OBSERVATIONS WITH MISSING VALUES in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-OUTPUT-OBSERVATIONS-WITH-MISSING-VALUES/m-p/371404#M11246</link>
    <description>&lt;P&gt;The second is very easy though routine and tedious repeatedly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data _varname;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where missing (varname);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeat for each variable of interest.&lt;/P&gt;
&lt;P&gt;If your variable names are not too long you could automate this with:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table vars as
   select name
   from dictionary.columns
   where libname='MYLIB' and memname='SETNAME'
   ;
quit;

data _null_;
   set vars;
   call execute ("data "|| cats('_',name)||';');
   call execute ("set MYLIB.SETNAME;");
   call execute ("where missing("||name||");");
   call execute ("run;");
run;&lt;/PRE&gt;
&lt;P&gt;MYLIB should be replaced with the name of your library or WORK if you didn't specify and SETNAME with the name of your data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Proc SQL code those should be in upper case as that is how they are stored in the Dictionary.Columns table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Missing in some but not all needs additional explanation as you have a lot of possible combinations.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2017 17:55:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-06-28T17:55:48Z</dc:date>
    <item>
      <title>SAS OUTPUT OBSERVATIONS WITH MISSING VALUES</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-OUTPUT-OBSERVATIONS-WITH-MISSING-VALUES/m-p/371361#M11245</link>
      <description>&lt;P&gt;Hi, I have a problem of output observations which contains missing values in some variables, but not all the variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currentlly, I have a dataset, which contains 53 character variables and 24 numeric variables, and about 100000 observations. I would like to output a new table which contains those observations, which have missing values in&amp;nbsp;&lt;SPAN&gt;some variables, but not all the variables.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or, I like to output each table for each variable, which only contains observations which contain missing values under this variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone show me code to do this?&lt;/P&gt;&lt;P&gt;Many appreciation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 16:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-OUTPUT-OBSERVATIONS-WITH-MISSING-VALUES/m-p/371361#M11245</guid>
      <dc:creator>JinboZhao</dc:creator>
      <dc:date>2017-06-28T16:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS OUTPUT OBSERVATIONS WITH MISSING VALUES</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-OUTPUT-OBSERVATIONS-WITH-MISSING-VALUES/m-p/371404#M11246</link>
      <description>&lt;P&gt;The second is very easy though routine and tedious repeatedly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data _varname;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where missing (varname);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeat for each variable of interest.&lt;/P&gt;
&lt;P&gt;If your variable names are not too long you could automate this with:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table vars as
   select name
   from dictionary.columns
   where libname='MYLIB' and memname='SETNAME'
   ;
quit;

data _null_;
   set vars;
   call execute ("data "|| cats('_',name)||';');
   call execute ("set MYLIB.SETNAME;");
   call execute ("where missing("||name||");");
   call execute ("run;");
run;&lt;/PRE&gt;
&lt;P&gt;MYLIB should be replaced with the name of your library or WORK if you didn't specify and SETNAME with the name of your data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Proc SQL code those should be in upper case as that is how they are stored in the Dictionary.Columns table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Missing in some but not all needs additional explanation as you have a lot of possible combinations.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 17:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-OUTPUT-OBSERVATIONS-WITH-MISSING-VALUES/m-p/371404#M11246</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-28T17:55:48Z</dc:date>
    </item>
  </channel>
</rss>

