<?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: Is there a way to select all non-empty values from table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281394#M57063</link>
    <description>&lt;P&gt;I forgot about this %DROPMISS macro which I have used in the past - works on character &amp;amp; numeric variables.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/048-2010.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/048-2010.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jun 2016 11:15:05 GMT</pubDate>
    <dc:creator>JohnHoughton</dc:creator>
    <dc:date>2016-06-30T11:15:05Z</dc:date>
    <item>
      <title>Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281383#M57058</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with &amp;gt;900 variables and whenever I want to check something on it and I don't have a list of variables that are of my interest, I use select(*) and have to scroll right and watch all the columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an fast way to filter the table I am looking at so that for my conditions in where statement I am getting only those columns, that are not empty? In my dataset for about 900 variables about 2/3 of them are being empty for those queries I am&amp;nbsp;looking.&lt;/P&gt;&lt;P&gt;I dont want to view only those columns I'm interested with, which would be the best idea but these queries require that I get different sets of variables every time so I just want to get rid of the empty ones.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lukasz Stasiak&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 10:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281383#M57058</guid>
      <dc:creator>LukaszStasiak</dc:creator>
      <dc:date>2016-06-30T10:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281389#M57060</link>
      <description>Are the variables all numeric? If yes, then I would start by using proc means or summary with the where condition to get a count of missing values for each variable. Then transpose &amp;amp; then use the _freq_ variable to calculate the percentage missing. Then use proc sql with a select ... into where pctmiss &amp;lt;100 clause to create a macro variable containing a variable list of variables that are not 100% missing. Then use that macro variable in a keep= statement to create a subset of the original dataset.&lt;BR /&gt;&lt;BR /&gt;However , if the variables you are looking at are character, or a mixture of character &amp;amp; numeric then that won't work</description>
      <pubDate>Thu, 30 Jun 2016 10:48:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281389#M57060</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2016-06-30T10:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281394#M57063</link>
      <description>&lt;P&gt;I forgot about this %DROPMISS macro which I have used in the past - works on character &amp;amp; numeric variables.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/048-2010.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/048-2010.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 11:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281394#M57063</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2016-06-30T11:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281398#M57065</link>
      <description>&lt;P&gt;It depends if you have all missing or simply a lot missing. If all missing use&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36257"&gt;@JohnHoughton﻿&lt;/a&gt;&amp;nbsp;solution. If it's a lot, consider switching your data structure to a long format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 11:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281398#M57065</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-30T11:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281533#M57113</link>
      <description>&lt;P&gt;SAS can work with all kinds of data, but humans cannot deal with 900+ dimensions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normalize your data and your life will get simpler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Database_normalization" target="_blank"&gt;https://en.wikipedia.org/wiki/Database_normalization&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 18:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281533#M57113</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-30T18:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281606#M57135</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.class;
 call missing(name,height);
run;



ods select none;
ods output nlevels=nlevels;
proc freq data=have nlevels;
table _all_;
run;
ods select all;

proc sql noprint;
 select tablevar into : drop separated by ','
  from nlevels
   where NNonMissLevels=0;
 alter table have
  drop &amp;amp;drop;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Jul 2016 02:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281606#M57135</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-01T02:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281684#M57152</link>
      <description>&lt;P&gt;Hi, Caould you explain the data step.&lt;/P&gt;
&lt;P&gt;/* Code*/&lt;/P&gt;
&lt;P&gt;data _null_ ;&lt;BR /&gt; set _cntnts_ end=lastobs nobs=nobs ;&lt;BR /&gt;SAS Global Forum 2010 Coders' Corner&lt;BR /&gt;4&lt;BR /&gt; if nobs = 0 then stop ;&lt;BR /&gt; &lt;STRONG&gt;n_char + ( type = 2 ) ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; n_num + ( type = 1 ) ;&lt;/STRONG&gt;&lt;BR /&gt; /* create macro vars containing final # of char, numeric variables */&lt;BR /&gt; if lastobs&lt;BR /&gt; then do ;&lt;BR /&gt; call symput( 'N_CHAR', left( put( n_char, 5. ))) ;&lt;BR /&gt; call symput( 'N_NUM' , left( put( n_num , 5. ))) ;&lt;BR /&gt; end ;&lt;BR /&gt; run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whats the below logic&amp;nbsp;do?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;n_char + ( type = 2 ) ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;n_num + ( type = 1 ) ;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 11:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281684#M57152</guid>
      <dc:creator>SJN</dc:creator>
      <dc:date>2016-07-01T11:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281691#M57153</link>
      <description>&lt;P&gt;It's creating a count of the number of character and numeric variables based on the value of the type variable in the proc contents output.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/281691#M57153</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2016-07-01T12:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to select all non-empty values from table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/867783#M342744</link>
      <description>&lt;P&gt;I know this is a really old thread, but I finally have a use for this - I've got a SAS dataset with hundreds of hospital diagnosis codes, and I only want to keep the code fields that have at least one non-blank value (to save space). I was going to use &lt;SPAN class=""&gt;&lt;SPAN&gt;Sridharma&lt;/SPAN&gt;&lt;/SPAN&gt;'s %DROPMISS macro mentioned above (it's hundreds of lines of SAS code, but it works well). However, this option using the NLEVELS option (which I've never heard of) also works well, and it's MUCH shorter. I think I'll use that. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-select-all-non-empty-values-from-table/m-p/867783#M342744</guid>
      <dc:creator>bnawrocki</dc:creator>
      <dc:date>2023-04-03T15:47:53Z</dc:date>
    </item>
  </channel>
</rss>

