<?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 delete blank columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42850#M8750</link>
    <description>hello&lt;BR /&gt;
&lt;BR /&gt;
i have a data set containing columns x y z. data set contains 10 records. i want to check if x has a value for each observation. however if all 10 records have a value of missing or 0 in x, i want to delete the column x. how can i do that? &lt;BR /&gt;
&lt;BR /&gt;
thanks!</description>
    <pubDate>Wed, 10 Jun 2009 07:36:43 GMT</pubDate>
    <dc:creator>milts</dc:creator>
    <dc:date>2009-06-10T07:36:43Z</dc:date>
    <item>
      <title>delete blank columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42850#M8750</link>
      <description>hello&lt;BR /&gt;
&lt;BR /&gt;
i have a data set containing columns x y z. data set contains 10 records. i want to check if x has a value for each observation. however if all 10 records have a value of missing or 0 in x, i want to delete the column x. how can i do that? &lt;BR /&gt;
&lt;BR /&gt;
thanks!</description>
      <pubDate>Wed, 10 Jun 2009 07:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42850#M8750</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2009-06-10T07:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: delete blank columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42851#M8751</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
For this we need to run PROC MEANS with (N NMISS MIN MAX) on the data first to identify those variables having missing values or zero's.&lt;BR /&gt;
After this we can drop those variables whose N=NMISS or (MIN=0 and MAX=0) by using DROP or KEEP.&lt;BR /&gt;
&lt;BR /&gt;
Hope this will help you</description>
      <pubDate>Wed, 10 Jun 2009 10:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42851#M8751</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-10T10:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: delete blank columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42852#M8752</link>
      <description>if you are generating this table in a data step, you could create a retained variable to count the number of time that x is missing and then on the last observation, compare that variable with _n_ and if they are equal conditionally execute a data step to drop that variable...like:&lt;BR /&gt;
data xyz;&lt;BR /&gt;
  set abc(keep=x y z) end=lastone;&lt;BR /&gt;
  retain x_missing 0;&lt;BR /&gt;
  x_missing = x_missing + missing(x);&lt;BR /&gt;
  if lastone then do;&lt;BR /&gt;
    if x_missing = _n_ then call execute('data def;set xyz(keep=y z);run;');&lt;BR /&gt;
  end;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 11 Jun 2009 17:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42852#M8752</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2009-06-11T17:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: delete blank columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42853#M8753</link>
      <description>i see. thanks a lot for the help !</description>
      <pubDate>Sun, 14 Jun 2009 23:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42853#M8753</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2009-06-14T23:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: delete blank columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42854#M8754</link>
      <description>Try this&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data d1;&lt;BR /&gt;
set s1;&lt;BR /&gt;
if x=y=z then flag='v';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data d2;&lt;BR /&gt;
set d1;&lt;BR /&gt;
if flag ne 'v' then delete;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 15 Jun 2009 06:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/delete-blank-columns/m-p/42854#M8754</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-15T06:01:06Z</dc:date>
    </item>
  </channel>
</rss>

