<?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 a series of variables in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143558#M261752</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work for me. please post your code and log file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2014 19:23:22 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2014-01-16T19:23:22Z</dc:date>
    <item>
      <title>how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143551#M261745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to drop/delete F1_flag, F2_flag, F3_flag, .... F99_flag from my dataset. &lt;/P&gt;&lt;P&gt;How can I do this efficiently? Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143551#M261745</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2014-01-16T15:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143552#M261746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you don't have other varaibles staring with "f" you could use:&lt;/P&gt;&lt;P&gt;drop f:;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143552#M261746</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2014-01-16T15:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143553#M261747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is the problem. I do have F1, F2, ... in my dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143553#M261747</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2014-01-16T15:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143554#M261748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input a1_flag a2_flag a3_flag a1 a2;&lt;BR /&gt;cards;&lt;BR /&gt;1 2 3 4 5&lt;BR /&gt;;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt; select name into : dropped separated by ' '&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE' and upcase(name) contains "FLAG";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; drop &amp;amp;dropped;&lt;BR /&gt;proc print;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143554#M261748</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2014-01-16T15:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143555#M261749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If those flag variables were created in order, then you can delete with one simple statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop F1_flag -- F99_flag;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find out if they are in order, do &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents position ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 16:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143555#M261749</guid>
      <dc:creator>kmoonmurr</dc:creator>
      <dc:date>2014-01-16T16:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143556#M261750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have you tried your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 18:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143556#M261750</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2014-01-16T18:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143557#M261751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yup. I do it all the time but I did create a simple data set before I sent this reply to you just to be sure. Works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 19:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143557#M261751</guid>
      <dc:creator>kmoonmurr</dc:creator>
      <dc:date>2014-01-16T19:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143558#M261752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work for me. please post your code and log file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 19:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143558#M261752</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2014-01-16T19:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143559#M261753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Key_oy: One problem with Linlin's suggested code, which may or may not be an issue with your data, is that it will drop any variable that contains the string flag.&amp;nbsp; E.g., in a data set like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a1_flag a2_flag a3_flag a1 a2 _flag_I_want;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 3 4 5 6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it would also drop flag_I_want.&amp;nbsp; The following is a way around that, namely just to drop variables that end with _flag:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name into : dropped separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname='WORK' and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname='HAVE' and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reverse(upcase(trim(name))) like "GALF_%"&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; drop &amp;amp;dropped;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 20:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143559#M261753</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-01-16T20:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143560#M261754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See the following code that drops only the variables starting with a and ending with flag. I updated Linlin's code with like and &lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'A%FLAG'&lt;/SPAN&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input a1_flag a2_flag a3_flag a1 a2;&lt;BR /&gt;cards;&lt;BR /&gt;1 2 3 4 5&lt;BR /&gt;;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt; select name into : dropped separated by ' '&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE' and&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; upcase(name) like &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'A%FLAG'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; drop &amp;amp;dropped;&lt;BR /&gt;proc print;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2014 04:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143560#M261754</guid>
      <dc:creator>mikki</dc:creator>
      <dc:date>2014-01-17T04:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143561#M261755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Hi,,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;If your variable names are contiguous,then you can simply use like bellow...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; f1 f2 f3 f4 f5 f6 n1 n2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: #ffffc0; color: black; font-size: 10pt;"&gt;1 2 3 4 5 6 8 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; yy;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; y;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; f1-f6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Sanjeev.K&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2014 05:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143561#M261755</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2014-01-17T05:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to drop a series of variables in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143562#M261756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you drop the variables using drop option rather than drop statement, than it will be more efficient way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abc ;&lt;/P&gt;&lt;P&gt; set xyz (drop = &amp;amp;dropped.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Oct 2014 10:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-drop-a-series-of-variables-in-SAS/m-p/143562#M261756</guid>
      <dc:creator>deval</dc:creator>
      <dc:date>2014-10-25T10:01:23Z</dc:date>
    </item>
  </channel>
</rss>

