<?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: Columns with no data -- check all datasets in library in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436141#M108449</link>
    <description>&lt;P&gt;This gets asked once a week. In my experience, PROC FREQ is the most versatile and fast solution with the MISSING format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a slightly more elaborate version, but I like the output.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111" target="_blank"&gt;https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 03:45:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-02-12T03:45:26Z</dc:date>
    <item>
      <title>Columns with no data -- check all datasets in library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436136#M108446</link>
      <description>&lt;P&gt;I have a library of about 50 SAS datasets. I would like to print the dataset name, and column(s) that are blank (no data). The format of these dataset columns can be of mixed type. There is a solution to a similar problem here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Columns-with-No-Data/td-p/283014" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Columns-with-No-Data/td-p/283014&lt;/A&gt; but it is only for one dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution is to&amp;nbsp;wrap a macro around the solution in the link, so that proc freq is ran on every single dataset and checks for empty columns. Could there be a more efficient way? I looked into PROC SQL (dictionary.columns) but it doesn't have a flag column for empty columns (other than length = 1, however variables like Gender can be length 1).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 03:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436136#M108446</guid>
      <dc:creator>sasRus</dc:creator>
      <dc:date>2018-02-12T03:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Columns with no data -- check all datasets in library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436141#M108449</link>
      <description>&lt;P&gt;This gets asked once a week. In my experience, PROC FREQ is the most versatile and fast solution with the MISSING format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a slightly more elaborate version, but I like the output.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111" target="_blank"&gt;https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 03:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436141#M108449</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-12T03:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Columns with no data -- check all datasets in library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436192#M108480</link>
      <description>&lt;P&gt;The more efficient way is using IML code. Would you like to use IML code ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
 set sashelp.class;
 call missing(age,name);
run;
data heat;
 set sashelp.heart;
 call missing(weight,height);
run;
data class;
 set sashelp.class;
run;


proc iml;
dsn=datasets(work);
do i=1 to nrow(dsn);
  use (dsn[i]);
  read all var _char_ into char[c=vname_char];
  read all var _num_  into num[c=vname_num];
  close;
  n_char=countn(char,'col');
  n_num=countn(num,'col'); 
  if ^ isempty(loc((t(n_char)//t(n_num))=0)) then do;
    idx=loc((t(n_char)//t(n_num))=0);
    name=(t(vname_char)//t(vname_num))[idx];
    table=repeat(dsn[i],nrow(name));
    
    want_table=want_table//table;
    want_name=want_name//name;
  end;
end;
create want var{want_table want_name};
append;
close;
quit;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 10:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436192#M108480</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-12T10:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Columns with no data -- check all datasets in library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436243#M108494</link>
      <description>hi Ksharp, thank you for your solution. Though I nor other users have proc IML installed. I think I will stick with the proc freq macro so that other users can run the program without having to install proc IML.</description>
      <pubDate>Mon, 12 Feb 2018 15:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Columns-with-no-data-check-all-datasets-in-library/m-p/436243#M108494</guid>
      <dc:creator>sasRus</dc:creator>
      <dc:date>2018-02-12T15:21:55Z</dc:date>
    </item>
  </channel>
</rss>

