<?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 deleting variables in order in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10602#M1040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art, but this looks a lot more complicated than it should be. Is there any simple code for droping sequntial variables?&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2012 17:49:43 GMT</pubDate>
    <dc:creator>R_A_G_</dc:creator>
    <dc:date>2012-02-22T17:49:43Z</dc:date>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10597#M1035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAS experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a huge dataset that need to delete variables for example 2-20 and need to know how.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:40:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10597#M1035</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2012-02-22T17:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10598#M1036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check out 'drop' or 'keep' statements or options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;drop sex--weight;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10598#M1036</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-22T17:44:19Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10599#M1037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at datanull's suggested method at: &lt;A _jive_internal="true" href="https://communities.sas.com/message/38407#38407"&gt;http://communities.sas.com/message/38407#38407&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10599#M1037</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-22T17:45:59Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10600#M1038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is a dataset with 500 variables, It would be very hard to do this one by one, I need to drop let say variables 10 through variable 20. I have droped the ones with same prefix but there are more to drop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10600#M1038</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2012-02-22T17:46:43Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10601#M1039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if they are in order like you said, you can use '--' to do the job. just edit my post. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10601#M1039</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-22T17:48:36Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10602#M1040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art, but this looks a lot more complicated than it should be. Is there any simple code for droping sequntial variables?&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10602#M1040</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2012-02-22T17:49:43Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10603#M1041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The method is easier than it appears.&amp;nbsp; Here is an example dropping variable 2 thru 3 from sashelp.class:&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&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :vlist separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; where libname eq 'SASHELP' 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;&amp;nbsp;&amp;nbsp; memname = "CLASS" 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;&amp;nbsp;&amp;nbsp; varnum between 2 and 3 &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 sashelp.class (drop=&amp;amp;vlist.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 17:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10603#M1041</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-22T17:58:38Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10604#M1042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what is easier than using a variable name range list as suggested above.&amp;nbsp; Read the documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using name range lists (such as sex -- weight) is dangerous enough without being able drop variables by position without even knowing the variables names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 18:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10604#M1042</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-22T18:06:51Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10605#M1043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never worked with SQL syntax, so I actually do not know what any of these lines mean. Is there any other way to do this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 18:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10605#M1043</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2012-02-22T18:14:21Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10606#M1044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While I agree with Tom that it is dangerous to drop variable by number, the only lines that have to be changed in the proc sql code are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname eq 'SASHELP' and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;SASHELP&amp;nbsp; has to be changed to the library where your data is located, but typed in UPPER CASE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname = "CLASS" and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;CLASS has to &lt;SPAN style="background-color: #ffffff;"&gt;be changed to the name of your data file, but typed in UPPER CASE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum between 2 and 3&lt;/P&gt;&lt;P&gt;and, where I used 2 and 3 in the above statement, if you wanted to drop variables 10 thru 20 you would replace that line with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum between 10 and 20&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 18:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10606#M1044</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-22T18:19:31Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10607#M1045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you would be more comfortable with a low-tech approach.&amp;nbsp; If that's true ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run a PROC CONTENTS on the data set, adding the POSITION option.&amp;nbsp; That way, you can see a list of all variables in order.&amp;nbsp; You will more easily be able to select ranges of variables to remove, and apply that using the syntax that has already been shown here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set old (drop=first_variable_to_drop -- last_variable_to_drop&amp;nbsp; first_variable_in_another_range -- last_variable_in_another_range);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll need to know the names of the first and last variable being dropped. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 19:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10607#M1045</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-22T19:08:40Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10608#M1046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or even lower tech just open the dataset or proc print it and you will see the variables in order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 19:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10608#M1046</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-22T19:18:31Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10609#M1047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Low tech sounds great to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 23:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10609#M1047</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2012-02-22T23:51:54Z</dc:date>
    </item>
    <item>
      <title>deleting variables in order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10610#M1048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are worried about the order of the variables then how about trying this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let varlist1=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;*Define your variable list in the order you would like to keep;&lt;/P&gt;&lt;P&gt;%let varlist2=&amp;nbsp; ; * Define you variables that you would like to drop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;set dsin;&lt;/P&gt;&lt;P&gt;drop &amp;amp;varlist2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;Data dsout;&lt;/P&gt;&lt;P&gt;retail &amp;amp;varlist1;&lt;/P&gt;&lt;P&gt;set a;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 01:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-variables-in-order/m-p/10610#M1048</guid>
      <dc:creator>Mit</dc:creator>
      <dc:date>2012-02-23T01:24:59Z</dc:date>
    </item>
  </channel>
</rss>

