<?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: how to drop obsolete variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532216#M5997</link>
    <description>&lt;P&gt;SASHELP.VCOLUMNS table has information on the variables, including labels. You can compile a list of variables that have the 'obsolete' in the label and use it to drop them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to put the name of the library and data set in upper case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
select name into :drop_list separated by " "
from sashelp.vcolumn
where upcase(libname)='WORK' and upcase(memname)='HAVE' and upcase(label) like '%OBSOLETE%';;
quit;


data want;
set have;

drop &amp;amp;drop_list;
run;
&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253536"&gt;@JP1234&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt; 

data t1;

x=1;

y=2;

z=3;

 

w

u

v



label x="this is obsolete xx " y="this obsolete is yy" z="this is zz";

run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data t1 has about 500 variables. about 100have 'obsolete' in their label like x and y.&lt;/P&gt;
&lt;P&gt;How can I drop these varibles from t1 based on labels.&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Feb 2019 22:06:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-02-01T22:06:53Z</dc:date>
    <item>
      <title>how to drop obsolete variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532213#M5995</link>
      <description>&lt;PRE&gt; 

data t1;

x=1;

y=2;

z=3;

 

w

u

v



label x="this is obsolete xx " y="this obsolete is yy" z="this is zz";

run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data t1 has about 500 variables. about 100have 'obsolete' in their label like x and y.&lt;/P&gt;&lt;P&gt;How can I drop these varibles from t1 based on labels.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 21:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532213#M5995</guid>
      <dc:creator>JP1234</dc:creator>
      <dc:date>2019-02-01T21:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop obsolete variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532216#M5997</link>
      <description>&lt;P&gt;SASHELP.VCOLUMNS table has information on the variables, including labels. You can compile a list of variables that have the 'obsolete' in the label and use it to drop them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to put the name of the library and data set in upper case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
select name into :drop_list separated by " "
from sashelp.vcolumn
where upcase(libname)='WORK' and upcase(memname)='HAVE' and upcase(label) like '%OBSOLETE%';;
quit;


data want;
set have;

drop &amp;amp;drop_list;
run;
&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253536"&gt;@JP1234&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt; 

data t1;

x=1;

y=2;

z=3;

 

w

u

v



label x="this is obsolete xx " y="this obsolete is yy" z="this is zz";

run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data t1 has about 500 variables. about 100have 'obsolete' in their label like x and y.&lt;/P&gt;
&lt;P&gt;How can I drop these varibles from t1 based on labels.&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 22:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532216#M5997</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-01T22:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop obsolete variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532218#M5998</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t1;
attrib x label="this is obsolete xx"
	   y label="this obsolete is yy"
	   z label="this is zz";
x=1;y=2;z=3;output;
run;

proc contents data=t1 out=tmp(keep=name label) nodetails noprint;
run;


Proc Sql noprint;
	Select name into :drp_lst separated by ','
		from tmp
	where findw(label,'obsolete');

alter table t1
drop &amp;amp;drp_lst;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Feb 2019 22:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-drop-obsolete-variables/m-p/532218#M5998</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-02-01T22:14:40Z</dc:date>
    </item>
  </channel>
</rss>

