<?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 Macro in drop and keep statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21212#M3388</link>
    <description>I defined a macro for the number of variables say,&lt;BR /&gt;
and I wanna drop the variabes in my data step, &lt;BR /&gt;
&lt;BR /&gt;
 %let num = 5;&lt;BR /&gt;
data xx;&lt;BR /&gt;
 set yy;&lt;BR /&gt;
 drop var1 - var&amp;amp;num;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
This doesn't work for such consecutive selection.Any idea to make it work? Thanks and Regards.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Fred_Gavin</description>
    <pubDate>Mon, 20 Apr 2009 18:18:05 GMT</pubDate>
    <dc:creator>Fred_Gavin</dc:creator>
    <dc:date>2009-04-20T18:18:05Z</dc:date>
    <item>
      <title>Macro in drop and keep statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21212#M3388</link>
      <description>I defined a macro for the number of variables say,&lt;BR /&gt;
and I wanna drop the variabes in my data step, &lt;BR /&gt;
&lt;BR /&gt;
 %let num = 5;&lt;BR /&gt;
data xx;&lt;BR /&gt;
 set yy;&lt;BR /&gt;
 drop var1 - var&amp;amp;num;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
This doesn't work for such consecutive selection.Any idea to make it work? Thanks and Regards.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Fred_Gavin</description>
      <pubDate>Mon, 20 Apr 2009 18:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21212#M3388</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-04-20T18:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in drop and keep statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21213#M3389</link>
      <description>Please elaborate on what doesn't work - possibly show how you want your SAS variables to appear at input and then at output (DATA step completion), including in your post one or more DATA steps as you mention "consecutive selection".&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 20 Apr 2009 18:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21213#M3389</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-20T18:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in drop and keep statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21214#M3390</link>
      <description>The name of the variable in the data, say, is var1, var2, var3, var4, var5. and others.. I want to drop var1 to var 5.&lt;BR /&gt;
&lt;BR /&gt;
then when I use macro;&lt;BR /&gt;
&lt;BR /&gt;
%let num = 5;&lt;BR /&gt;
 data xx;&lt;BR /&gt;
  set yy;&lt;BR /&gt;
  drop var1-var&amp;amp;num;&lt;BR /&gt;
 run;&lt;BR /&gt;
&lt;BR /&gt;
it results in the error for the statement "var1-var&amp;amp;num".</description>
      <pubDate>Tue, 21 Apr 2009 02:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21214#M3390</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-04-21T02:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in drop and keep statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21215#M3391</link>
      <description>The error must be outside the code you have posted. &lt;BR /&gt;
[pre]&lt;BR /&gt;
data work.start;&lt;BR /&gt;
    input a $ val1 val2 val3 val4 val5;&lt;BR /&gt;
    datalines;&lt;BR /&gt;
a1 1 2 3 4 5&lt;BR /&gt;
a2 2 3 4 5 6&lt;BR /&gt;
a3 3 4 5 6 7&lt;BR /&gt;
b1 5 4 3 2 1&lt;BR /&gt;
b2 4 3 2 1 0&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%let num = 5;&lt;BR /&gt;
&lt;BR /&gt;
data work.short;&lt;BR /&gt;
    set work.start;&lt;BR /&gt;
    drop val1-val&amp;amp;num;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%symdel num;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Works as intended.</description>
      <pubDate>Tue, 21 Apr 2009 07:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21215#M3391</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2009-04-21T07:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in drop and keep statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21216#M3392</link>
      <description>You will need to share your SAS log information listing the exact error message and the failing SAS code, after reviewing the output yourself.  If you using macro code, you will want to specify the following SAS statement to generate the most diagnostics info possible:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT MLOGIC;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hopefully you will see the problem after generating more information with your code execution.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 21 Apr 2009 14:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-drop-and-keep-statement/m-p/21216#M3392</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-21T14:47:31Z</dc:date>
    </item>
  </channel>
</rss>

