<?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: Delete empty columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/279885#M56470</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
 set sashelp.class;
 call missing(name,age);
run;



ods select none;
ods output nlevels=temp;
proc freq data=class nlevels;
tables _all_;
run;
ods select all;
proc sql noprint;
 select tablevar into : drop separated by ' '
  from temp 
   where NNonMissLevels=0;
quit;
data want;
 set class(drop=&amp;amp;drop);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Jun 2016 01:32:27 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-06-24T01:32:27Z</dc:date>
    <item>
      <title>Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/279878#M56465</link>
      <description>&lt;P&gt;What's the easiest way to remove empty columns/variables from a data set? As in when I get a subset of data from my main dataset, if there are columns which are empty/null in that subset, how do I write a program to remove such variables from the subset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 23:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/279878#M56465</guid>
      <dc:creator>aaou</dc:creator>
      <dc:date>2016-06-23T23:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/279885#M56470</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
 set sashelp.class;
 call missing(name,age);
run;



ods select none;
ods output nlevels=temp;
proc freq data=class nlevels;
tables _all_;
run;
ods select all;
proc sql noprint;
 select tablevar into : drop separated by ' '
  from temp 
   where NNonMissLevels=0;
quit;
data want;
 set class(drop=&amp;amp;drop);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2016 01:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/279885#M56470</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-24T01:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280156#M56566</link>
      <description>&lt;P&gt;Is there a way to do this without specifying the names of the variables?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 16:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280156#M56566</guid>
      <dc:creator>aaou</dc:creator>
      <dc:date>2016-06-25T16:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280180#M56568</link>
      <description>&lt;PRE&gt;

???  That was exactly what I am doing . No need any variable name, just run the code and gave you what you want .

&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jun 2016 04:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280180#M56568</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-26T04:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280188#M56572</link>
      <description>Instead of worry about empty columns, why not just keep the ones that you actually need?</description>
      <pubDate>Sun, 26 Jun 2016 09:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280188#M56572</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-26T09:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280621#M56735</link>
      <description>&lt;P&gt;It's like this, these variables have values for certain years. But &amp;nbsp;are empty for some years. So when I want to extract a dataset for a particular year from the main dataset, I want in that dataset all the null columns not to appear. Could you advice me how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 01:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280621#M56735</guid>
      <dc:creator>aaou</dc:creator>
      <dc:date>2016-06-28T01:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280663#M56750</link>
      <description>1. Take control over your data. This could involve having a meta data table containing information of which variables appear what years. Then you could dynamically build a keep statement during you filtering. Or&lt;BR /&gt;2. Search these forums for a more generic solution. There have been multiple similar inquiries the last couple of months.</description>
      <pubDate>Tue, 28 Jun 2016 06:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/280663#M56750</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-28T06:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Delete empty columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/667956#M200126</link>
      <description>&lt;P&gt;Hi, i stumbled upon this and many posts when i have the same issue. please find my solution below (it's a bit manual where you need to know where the blank columns are).&lt;/P&gt;&lt;P&gt;proc contents data=messyexcel order=varnum out=abcde (keep=name varnum) noprint ;&lt;BR /&gt;run;*this will generate a dataset with all your variables and their variable number. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=abcde;&lt;BR /&gt;by varnum;&lt;BR /&gt;run;*sorting the output dataset by their variable number;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;*create a macro list to store all your variable names that you want to delete, in my case, anything beyond column 1186 are blanks;&lt;BR /&gt;select name into :deletelist separated by '&amp;nbsp; '&lt;BR /&gt;from abcde&lt;BR /&gt;where varnum&amp;gt;1186;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data better_data (drop=&amp;amp;deletelist);&lt;BR /&gt;set messyexcel;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 04:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-empty-columns/m-p/667956#M200126</guid>
      <dc:creator>rob9999</dc:creator>
      <dc:date>2020-07-09T04:58:09Z</dc:date>
    </item>
  </channel>
</rss>

