<?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 variables by label criteria in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300312#M60518</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to remove some variables based on some criteria in their label. Specifically, I want to delete 'B' shares but these are only mentioned in the label and not in the name of the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;Name: INSTITUTO_ROSENBUCH_DE_BIOLOGIA&lt;/P&gt;
&lt;P&gt;Label: INSTITUTO ROSENBUCH DE BIOLOGIA 'B'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code I used to apply for names is the following, but how can I transform it to use it on labels (if possible)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;

    select trim(compress(name))
    into :drop_vars separated by ' '
    from SASHELP.VCOLUMN 
    where libname = upcase('WORK')
        and
            memname = upcase('Sample')
        and
            upcase(name) like '%ERROR%'
    ;
quit;

%put &amp;amp;drop_vars.;

data data2;
    set Sample;
    drop  &amp;amp;drop_vars.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2016 09:24:49 GMT</pubDate>
    <dc:creator>Costasg</dc:creator>
    <dc:date>2016-09-23T09:24:49Z</dc:date>
    <item>
      <title>Delete variables by label criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300312#M60518</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to remove some variables based on some criteria in their label. Specifically, I want to delete 'B' shares but these are only mentioned in the label and not in the name of the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;Name: INSTITUTO_ROSENBUCH_DE_BIOLOGIA&lt;/P&gt;
&lt;P&gt;Label: INSTITUTO ROSENBUCH DE BIOLOGIA 'B'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code I used to apply for names is the following, but how can I transform it to use it on labels (if possible)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;

    select trim(compress(name))
    into :drop_vars separated by ' '
    from SASHELP.VCOLUMN 
    where libname = upcase('WORK')
        and
            memname = upcase('Sample')
        and
            upcase(name) like '%ERROR%'
    ;
quit;

%put &amp;amp;drop_vars.;

data data2;
    set Sample;
    drop  &amp;amp;drop_vars.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 09:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300312#M60518</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2016-09-23T09:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables by label criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300314#M60519</link>
      <description>&lt;P&gt;Hint: Open Your data source and see if label column is present.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change your last condition from name to your label criteria. If it has the quotes make sure to include them in your search.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be a filter such as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; label_column_name like &amp;nbsp;"% 'B'"&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 09:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300314#M60519</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-23T09:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables by label criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300316#M60520</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
a=202;
label a ="temp new";
b=102;
label b="temp";
c=302;
label c ="var c";

run;

proc contents data =have out=contents;run;

proc sql;
select name into :var_list separated by ' '
from contents
where label ? 'temp';
quit;
%put &amp;amp;var_list;

data want;
set have;
drop &amp;amp;var_list;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In the above code I am dropping columns that has temp in their label.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 09:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300316#M60520</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-09-23T09:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables by label criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300320#M60521</link>
      <description>&lt;P&gt;Many thanks for your answers both!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 10:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-variables-by-label-criteria/m-p/300320#M60521</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2016-09-23T10:01:52Z</dc:date>
    </item>
  </channel>
</rss>

