<?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: Changing Dataset Names using SAS Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281431#M269831</link>
    <description>&lt;P&gt;Suggestion, use a prefix to differentiate datasets, not a suffix. SAS allows shortcut of reference names by prefixes, so later on this can be useful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ie append together all datasets starting with INT can be done via :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data int_master;&lt;/P&gt;
&lt;P&gt;set int_:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jun 2016 13:44:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-30T13:44:39Z</dc:date>
    <item>
      <title>Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281422#M269829</link>
      <description>&lt;P&gt;Hello all, I am trying to make three datasets from a macro that uses the macro variable name to make the name of the dataset. My issues arises from needing to make multiple datasets from different output and I want to change the name of the dataset so there are a total of three datasets with three different names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code and an example of what I am trying to do:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro tab1 (var);&lt;/P&gt;
&lt;P&gt;PROC SORT DATA = main OUT= &amp;amp;var ;&lt;BR /&gt;BY &amp;amp;var ;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;PROC FREQ DATA = &amp;amp;var ;&lt;BR /&gt;&amp;amp;POPULATION;&lt;BR /&gt;TABLES strata1 * strata2 * trtp * peoyn / nocol nopercent cmh;&lt;BR /&gt;by &amp;amp;var;&lt;BR /&gt;output cmh relrisk out= &amp;amp;var; /*&amp;lt;----- want this dataset to be renamed &amp;amp;var1*/&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ODS TRACE ON; &lt;BR /&gt;ODS OUTPUT ParameterEstimates= &amp;amp;var; /*&amp;lt;----- want this dataset to be renamed &amp;amp;var_INT*/ &lt;BR /&gt;proc logistic data=&amp;amp;var;&lt;BR /&gt;STRATA strata1 strata2;&lt;BR /&gt;&amp;amp;POPULATION;&lt;BR /&gt; class trtpn &amp;amp;var;&lt;BR /&gt; model peoynn = trtpn &amp;amp;var trtpn*&amp;amp;var;&lt;BR /&gt;run;&lt;BR /&gt;ODS TRACE OFF;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;%tab1 (variable_a); &lt;BR /&gt;%tab1 (variable_b);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The product will be six datasets named: (variable_a, variable_a1, variable_a_INT) and (variable_b, variable_b1, variable_b_INT).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help and let me know if youhave any questions,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Donald&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 13:16:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281422#M269829</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2016-06-30T13:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281424#M269830</link>
      <description>&lt;P&gt;If you want to use a macro variable as a prefix in a word, you must end the macro variable reference with a dot.&lt;/P&gt;
&lt;P&gt;&amp;amp;var1 will make SAS look for the macro variable var1 (which probably fails), while &amp;amp;var.1 will create xxx1 if var contained xxx&lt;/P&gt;
&lt;P&gt;yyy&amp;amp;var1.z would then create yyyxxxz&lt;/P&gt;
&lt;P&gt;You would therefore use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;output cmh relrisk out= &amp;amp;var.1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS OUTPUT ParameterEstimates= &amp;amp;var._INT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jun 2016 13:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281424#M269830</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-30T13:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281431#M269831</link>
      <description>&lt;P&gt;Suggestion, use a prefix to differentiate datasets, not a suffix. SAS allows shortcut of reference names by prefixes, so later on this can be useful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ie append together all datasets starting with INT can be done via :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data int_master;&lt;/P&gt;
&lt;P&gt;set int_:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 13:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281431#M269831</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-30T13:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281440#M269832</link>
      <description>&lt;P&gt;Hello KurtBremser,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This worked like a charm!! I defienlty have alot more to learn about macro programming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your assistance,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Donald&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 14:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281440#M269832</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2016-06-30T14:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281441#M269833</link>
      <description>&lt;P&gt;Hello Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An excellent and very useful idea. Thank you for this advice, I will incorprate this structure into my programming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Donald&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 14:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/281441#M269833</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2016-06-30T14:02:11Z</dc:date>
    </item>
  </channel>
</rss>

