<?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: Outputting many data sets from one set statement and Dropping and renaming Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676303#M203912</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133090"&gt;@RandyStan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the code; I get an error statement on the "DROP" part of the code&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why withhold this information from us in your original post? Anyway, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; has explained what the error is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But rarely do you need to split a data set like this. You could use a BY statement in whatever analyses you are doing, and then the splitting of the data set can be altogether avoided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if you want to do separate analyses when VarA=1 or VarA=2, one data set suffices, and so you may be performing extra unnecessary work, and if this is a large dataset, splitting it like this takes up more storage and more execution time (well, that's also true if it is a small data set, but then you won't really notice the extra execution time). Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have(where=(vara=1) Drop = VarF Rename = (VarM = VarMA VarN= VarNA));
    /* more PROC MEANS statements */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 20:52:27 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-08-12T20:52:27Z</dc:date>
    <item>
      <title>Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676290#M203906</link>
      <description>&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;&amp;nbsp; This is the code that I have written.&amp;nbsp; Am I making a mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data A B&amp;nbsp; ; Set have;&lt;/P&gt;&lt;P&gt;If VarA = 1 then output A (Drop = VarF (Rename = (VarM = VarMA VarN= VarNA)));&lt;/P&gt;&lt;P&gt;If VarA = 2 then output B (Drop = VarF (Rename = (VarK = VarKA VarL= VarLA)));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 19:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676290#M203906</guid>
      <dc:creator>RandyStan</dc:creator>
      <dc:date>2020-08-12T19:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676294#M203907</link>
      <description>There is a difference between your code being correct syntax wise, versus logically correct. From a syntax perspective your code appears correct but we have no way of knowing if it's what you're expecting. Or even if it's correct because of the variable names in the original data set are unknown. &lt;BR /&gt;&lt;BR /&gt;So we cannot tell you if you're making a mistake. What are you trying to do?</description>
      <pubDate>Wed, 12 Aug 2020 20:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676294#M203907</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-12T20:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676298#M203909</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133090"&gt;@RandyStan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; This is the code that I have written.&amp;nbsp; Am I making a mistake?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you run the code? Did it work? Did you do what you want? How can we know if you are making a mistake?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I have never seen this exact syntax (it may work, but I think it's wrong unless you remove the parentheses that I have colored red&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Drop = VarF &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;Rename = (VarM = VarMA VarN= VarNA)&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676298#M203909</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-12T20:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676301#M203910</link>
      <description>&lt;P&gt;No.&amp;nbsp; You cannot have dataset options on an OUTPUT statement. Those belong where the output dataset is defined.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data 
  A (Drop = VarF Rename = (VarM = VarMA VarN= VarNA))
  B (Drop = VarF Rename = (VarK = VarKA VarL= VarLA))
;
  set have;
  if VarA = 1 then output A;
  if VarA = 2 then output B;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676301#M203910</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-12T20:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676302#M203911</link>
      <description>&lt;P&gt;I am trying to split the data set "have" into different data sets and rename variables.&amp;nbsp; I can use multiple data steps; but for efficiency I just wanted to use one data statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the code; I get an error statement on the "DROP" part of the code&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676302#M203911</guid>
      <dc:creator>RandyStan</dc:creator>
      <dc:date>2020-08-12T20:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting many data sets from one set statement and Dropping and renaming Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676303#M203912</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133090"&gt;@RandyStan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the code; I get an error statement on the "DROP" part of the code&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why withhold this information from us in your original post? Anyway, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; has explained what the error is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But rarely do you need to split a data set like this. You could use a BY statement in whatever analyses you are doing, and then the splitting of the data set can be altogether avoided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if you want to do separate analyses when VarA=1 or VarA=2, one data set suffices, and so you may be performing extra unnecessary work, and if this is a large dataset, splitting it like this takes up more storage and more execution time (well, that's also true if it is a small data set, but then you won't really notice the extra execution time). Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have(where=(vara=1) Drop = VarF Rename = (VarM = VarMA VarN= VarNA));
    /* more PROC MEANS statements */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-many-data-sets-from-one-set-statement-and-Dropping/m-p/676303#M203912</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-12T20:52:27Z</dc:date>
    </item>
  </channel>
</rss>

