<?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: Check for Column and missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489045#M127564</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm not looking if a variable exists. I'm looking for a variable that contains TEST as part of variablename and if it has at least one missing values.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;HOW many variables are you concerned with in each data set? What does the output potentially look like with 10 variables?&lt;/P&gt;
&lt;P&gt;And are you really sure that you want every variable that may have 'TEST' as part of the name? What if you have a variable named "testimony" "intestate"&lt;/P&gt;
&lt;P&gt;Do you want each time a variable is missing or if any records in the set are missing values at least once?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Aug 2018 20:47:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-08-22T20:47:18Z</dc:date>
    <item>
      <title>Check for Column and missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489029#M127552</link>
      <description>&lt;P&gt;&amp;nbsp;there are 4 datasets a,b,c,d.&lt;BR /&gt;&amp;nbsp; How to look for a vraible name that has TEST in variablename like ATEST, BTEST and see if there aleast one record misssing?&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; Table A:&lt;BR /&gt;&amp;nbsp; Id ATEST&lt;BR /&gt;&amp;nbsp; 1&amp;nbsp; Testa&lt;BR /&gt;&amp;nbsp; 2&amp;nbsp; Testa&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; Table B:&lt;BR /&gt;&amp;nbsp; Id BTEST&lt;BR /&gt;&amp;nbsp; 1&amp;nbsp; Testb&lt;BR /&gt;&amp;nbsp; 2 &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; Table C:&lt;BR /&gt;&amp;nbsp; Id CTEST&lt;BR /&gt;&amp;nbsp; 1&amp;nbsp; TestC&lt;BR /&gt;&amp;nbsp; 2&amp;nbsp; TestC&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; Table &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt;&lt;BR /&gt;&amp;nbsp; Id DTEST&lt;BR /&gt;&amp;nbsp; 1 &amp;nbsp;&lt;BR /&gt;&amp;nbsp; 2 &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; So the output would be:&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; Dataset B&amp;nbsp;&amp;nbsp;&amp;nbsp; BTEST&lt;BR /&gt;&amp;nbsp; Dataset D&amp;nbsp;&amp;nbsp;&amp;nbsp; DTEST&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489029#M127552</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-08-22T20:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Column and missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489033#M127555</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;This may give you an idea on how to proceed&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro VarExist(ds, var);
    %local rc dsid result;
    %let dsid = %sysfunc(open(&amp;amp;ds));
 
    %if %sysfunc(varnum(&amp;amp;dsid, &amp;amp;var)) &amp;gt; 0 %then %do;
        %let result = 1;
        %put NOTE: Var &amp;amp;var exists in &amp;amp;ds;
    %end;
    %else %do;
        %let result = 0;
        %put NOTE: Var &amp;amp;var not exists in &amp;amp;ds;
    %end;
 
    %let rc = %sysfunc(close(&amp;amp;dsid));
    &amp;amp;result
%mend VarExist;
 
/* Usage */
%put %VarExist(sashelp.class, name);
%put %VarExist(sashelp.class, aaa);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Source :&amp;nbsp;&lt;A href="http://www.sascommunity.org/wiki/Tips:Check_if_a_variable_exists_in_a_dataset&amp;nbsp;" target="_blank"&gt;http://www.sascommunity.org/wiki/Tips:Check_if_a_variable_exists_in_a_dataset&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489033#M127555</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-08-22T20:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Column and missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489034#M127556</link>
      <description>&lt;P&gt;Are you designing this system? Can you change the naming convention so it's TESTA, TESTB, etc?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS works better with prefixes rather than suffixes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489034#M127556</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-22T20:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Column and missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489035#M127557</link>
      <description>&lt;P&gt;I'm not looking if a variable exists. I'm looking for a variable that contains TEST as part of variablename and if it has at least one missing values.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489035#M127557</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-08-22T20:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Column and missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489045#M127564</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm not looking if a variable exists. I'm looking for a variable that contains TEST as part of variablename and if it has at least one missing values.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;HOW many variables are you concerned with in each data set? What does the output potentially look like with 10 variables?&lt;/P&gt;
&lt;P&gt;And are you really sure that you want every variable that may have 'TEST' as part of the name? What if you have a variable named "testimony" "intestate"&lt;/P&gt;
&lt;P&gt;Do you want each time a variable is missing or if any records in the set are missing values at least once?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 20:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-Column-and-missing/m-p/489045#M127564</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-22T20:47:18Z</dc:date>
    </item>
  </channel>
</rss>

