<?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: %Do syntax trouble in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309810#M66758</link>
    <description>I tried that so many different ways but the correct way. I didnt realize the correct syntax was to include the 'drop =' in parentheses. &lt;BR /&gt;&lt;BR /&gt;Thanks for the help!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 07 Nov 2016 18:41:57 GMT</pubDate>
    <dc:creator>Ody</dc:creator>
    <dc:date>2016-11-07T18:41:57Z</dc:date>
    <item>
      <title>%Do syntax trouble</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309796#M66753</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one large data set (P_Top) that I divide into smaller datasets based on variable POD. These smaller data sets are then sent to a directory as excel files. My problem is that I want to drop the POD variable from these data sets prior to exporting them but am running into issues doing that. I'm pretty much blanking out because I'm using POD as the variable in the macro to create them to begin with. I feel like I'm tripping over my self here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate any thoughts? Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options mlogic mprint;&lt;BR /&gt;%macro split1 (data=, var=);&lt;BR /&gt;&lt;BR /&gt;/*distinct field */&lt;BR /&gt;proc sort data = P_Top out = PDS nodupkey;&lt;BR /&gt;by POD;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* workbook variables */&lt;BR /&gt;data PDS;&lt;BR /&gt;set PDS;&lt;BR /&gt;POD1 = tranwrd(trim(POD),' ','_');&lt;BR /&gt;keep POD POD1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set PDS end = last;&lt;BR /&gt;call symputx ('val'||left(_n_),POD); &lt;BR /&gt;call symputx ('valx'||left(_n_),POD1); &lt;BR /&gt;if last then call symput('count',_n_); &lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* POD datasets */&lt;BR /&gt;data %do i = 1 %to &amp;amp;count;&lt;BR /&gt;&amp;amp;&amp;amp;valx&amp;amp;i %end;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;set &amp;amp;data;&lt;BR /&gt;select(&amp;amp;var);&lt;BR /&gt;%do i = 1 %to &amp;amp;count;&lt;BR /&gt; when ("&amp;amp;&amp;amp;val&amp;amp;i") output &amp;amp;&amp;amp;valx&amp;amp;i; &lt;BR /&gt;%end;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%do i = 1 %to &amp;amp;count;&lt;BR /&gt; proc export &lt;BR /&gt; data = &amp;amp;&amp;amp;valx&amp;amp;i &lt;BR /&gt; outfile = "\\XD00040\&amp;amp;&amp;amp;valx&amp;amp;i" &lt;BR /&gt; DBMS = EXCEL replace;&lt;BR /&gt; SHEET = "&amp;amp;&amp;amp;valx&amp;amp;i";&lt;BR /&gt; run;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%mend split1;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;%split1&lt;BR /&gt;(&lt;BR /&gt;data = P_Top, &lt;BR /&gt;var = POD&lt;BR /&gt;);&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 18:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309796#M66753</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2016-11-07T18:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: %Do syntax trouble</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309804#M66756</link>
      <description>&lt;P&gt;There is a spot in the macro where you create the data sets.&amp;nbsp; That would be the proper point to drop the variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data %do i=1 %to &amp;amp;count;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;valx&amp;amp;i (drop=pod)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 18:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309804#M66756</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-07T18:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: %Do syntax trouble</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309810#M66758</link>
      <description>I tried that so many different ways but the correct way. I didnt realize the correct syntax was to include the 'drop =' in parentheses. &lt;BR /&gt;&lt;BR /&gt;Thanks for the help!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Nov 2016 18:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309810#M66758</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2016-11-07T18:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: %Do syntax trouble</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309910#M66787</link>
      <description>&lt;P&gt;The drop could have been in several places. The data set option is one: data outputdatasetname (drop = variablelist)&amp;nbsp;exclude the variables only from the specified set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;or as a separate statement within the data step:&amp;nbsp;&amp;nbsp; drop pod; run;&amp;nbsp; or: Set &amp;amp;data; drop pod;&lt;/P&gt;
&lt;P&gt;Poor form but it would even work within a Select block as Drop like Format and label are not actually executeable statements.&lt;/P&gt;
&lt;P&gt;would drop the selected variables from ANY data set built in the data step. Note this form does not use "="&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 00:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-syntax-trouble/m-p/309910#M66787</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-11-08T00:00:39Z</dc:date>
    </item>
  </channel>
</rss>

