<?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: Using a macro variable to name a datastep in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302344#M1224</link>
    <description>&lt;P&gt;This isnt a full solution for you.&lt;/P&gt;
&lt;P&gt;But the macro part of your problem works fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That message is a warning that in future versions of SAS there will be a modification on how to use that style of code you tried for macros.&lt;/P&gt;
&lt;P&gt;What version are you on? &amp;nbsp;I'm on 9.4. &amp;nbsp;so if you are on an earlier version that would explain things. &amp;nbsp;and it hampers my ability to recreate the exact message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to suggest a few things...&lt;/P&gt;
&lt;P&gt;1. your data step isnt reading in your data correctly. &amp;nbsp;Use: &amp;nbsp; infile datalines truncover; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. on things like the -tuesday- , -thursday-. &amp;nbsp;Try with them in quotes.&lt;/P&gt;
&lt;P&gt;3. the use of %macro cus(dsn); &amp;nbsp; isnt bad - but might i suggest naming the macro variable? &amp;nbsp;Its easier to read... Example: &amp;nbsp; %macro cus(dsn=); &amp;nbsp; &amp;nbsp; then when you call it you can use: &amp;nbsp; &amp;nbsp;%cus(dsn=cudata); &amp;nbsp;Its expecially helpful with a macro that has many variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;zeke torres&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wcsug.com" target="_self"&gt;wcsug.com&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2016 14:04:02 GMT</pubDate>
    <dc:creator>zekeT_sasaholic</dc:creator>
    <dc:date>2016-10-04T14:04:02Z</dc:date>
    <item>
      <title>Using a macro variable to name a datastep</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302338#M1222</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;i am having problems using mcros.Not getting the desired output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data cudata;&lt;BR /&gt;input ID Orderdate$ Model$12. Quantity ;&lt;BR /&gt;cards;&lt;BR /&gt;287 15OCT03 DeltaBreeze 15&lt;BR /&gt;287 15OCT03 SantaAna 15&lt;BR /&gt;274 16OCT03 JetStream 1&lt;BR /&gt;174 17OCT03 SantaAna 20&lt;BR /&gt;174 17OCT03 Noreaster 5&lt;BR /&gt;174 17OCT03 Scirocco 1&lt;BR /&gt;347 18OCT03 Mistral 1&lt;BR /&gt;287 21OCT03 DeltaBreeze 30&lt;BR /&gt;287 21OCT03 SantaAna 25&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro cus(dsn);&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday=Monday&lt;BR /&gt;%then %do;&lt;BR /&gt;proc print data=&amp;amp;dsn;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%else %if &amp;amp;sysday=Thursday&lt;BR /&gt;%then %do;&lt;BR /&gt;proc tabulate data=&amp;amp;dsn;&lt;BR /&gt;class ID;&lt;BR /&gt;var Quantity ;&lt;BR /&gt;table ID,Quantity;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%mend cus;&lt;/P&gt;&lt;P&gt;%cus(cudata);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;log&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;between a quoted string and the succeeding identifier is recommended.&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2016 13:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302338#M1222</guid>
      <dc:creator>rishabhmehra13</dc:creator>
      <dc:date>2016-10-04T13:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using a macro variable to name a datastep</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302341#M1223</link>
      <description>&lt;P&gt;The problem is most likely not with that code directly. &amp;nbsp;If you run code which has an open quote, i.e. a quote mark with no closing mark, then SAS treates everything after that as being text. &amp;nbsp;That is what the warning is telling you that it has read a certain amount of "text" and thinks you have unbalanced quote marks. &amp;nbsp;Simplest solution, restart the SAS system to get a fresh session, and check any code you write to ensure all quoted strings is finished.&lt;/P&gt;
&lt;P&gt;Also note, why bother with the whole macro thing? &amp;nbsp;Just run a proc print an tabulate, takes a fraction of a second, then send out one or the other file.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 13:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302341#M1223</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-04T13:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using a macro variable to name a datastep</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302344#M1224</link>
      <description>&lt;P&gt;This isnt a full solution for you.&lt;/P&gt;
&lt;P&gt;But the macro part of your problem works fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That message is a warning that in future versions of SAS there will be a modification on how to use that style of code you tried for macros.&lt;/P&gt;
&lt;P&gt;What version are you on? &amp;nbsp;I'm on 9.4. &amp;nbsp;so if you are on an earlier version that would explain things. &amp;nbsp;and it hampers my ability to recreate the exact message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to suggest a few things...&lt;/P&gt;
&lt;P&gt;1. your data step isnt reading in your data correctly. &amp;nbsp;Use: &amp;nbsp; infile datalines truncover; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. on things like the -tuesday- , -thursday-. &amp;nbsp;Try with them in quotes.&lt;/P&gt;
&lt;P&gt;3. the use of %macro cus(dsn); &amp;nbsp; isnt bad - but might i suggest naming the macro variable? &amp;nbsp;Its easier to read... Example: &amp;nbsp; %macro cus(dsn=); &amp;nbsp; &amp;nbsp; then when you call it you can use: &amp;nbsp; &amp;nbsp;%cus(dsn=cudata); &amp;nbsp;Its expecially helpful with a macro that has many variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;zeke torres&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wcsug.com" target="_self"&gt;wcsug.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 14:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-a-macro-variable-to-name-a-datastep/m-p/302344#M1224</guid>
      <dc:creator>zekeT_sasaholic</dc:creator>
      <dc:date>2016-10-04T14:04:02Z</dc:date>
    </item>
  </channel>
</rss>

