<?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: SAS Macro Errors in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393844#M25379</link>
    <description>&lt;P&gt;This is your problem:&lt;/P&gt;
&lt;P&gt;%let months =Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just put that text into your macro call:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%new(&amp;amp;dsn,&amp;amp;start_month,&amp;amp;END_month,Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Lots more paramters than expected. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As with anything like this, is is bad data modelling that has got your into this situation. &amp;nbsp;I am guessing from the _name_ that your doing some sort of proc transpose on the data. &amp;nbsp;Don't. &amp;nbsp;Unless that data is being used for a report and only a report, keep your data normalised - i.e. going down the page. &amp;nbsp;It is so much easier to program and use. &amp;nbsp;If you continue down this route, your code will be a mess, but it is possible with %nstr() and such like functions to mask the character string. &amp;nbsp;E.g.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%new(&amp;amp;dsn,&amp;amp;start_month,&amp;amp;END_month,%nstr(&amp;amp;months));&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2017 12:07:33 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-09-07T12:07:33Z</dc:date>
    <item>
      <title>SAS Macro Errors</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393841#M25378</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a macro defined as follows saved as a code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro new (dsn1,start_month1,END_month1,months1);&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE Total AS&lt;BR /&gt;select _NAME_,&lt;BR /&gt;&amp;amp;months1.&lt;BR /&gt;FROM Total;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;%mend new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am calling this macro code as :&lt;/P&gt;&lt;P&gt;%let dsn=AI_DB_MASTER;&lt;BR /&gt;%let start_month="01-JUL-2016"d; /*Starting month of 2016 the dashboard*/&lt;BR /&gt;%let END_month="31-JUL-2017"d;&lt;/P&gt;&lt;P&gt;%let months =Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Include "&amp;amp;path.\new4.sas"/source2;&lt;BR /&gt;%new(&amp;amp;dsn,&amp;amp;start_month,&amp;amp;END_month,&amp;amp;months);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I run the above statement I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable DSN resolves to AI_DB_MASTER&lt;BR /&gt;SYMBOLGEN: Macro variable START_MONTH resolves to "01-JUL-2016"d&lt;BR /&gt;SYMBOLGEN: Macro variable END_MONTH resolves to "31-JUL-2017"d&lt;BR /&gt;SYMBOLGEN: Macro variable MONTHS resolves to Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17&lt;BR /&gt;MLOGIC(NEW): Parameter DSN1 has value AI_DB_MASTER&lt;BR /&gt;MLOGIC(NEW): Parameter START_MONTH1 has value "01-JUL-2016"d&lt;BR /&gt;MLOGIC(NEW): Parameter END_MONTH1 has value "31-JUL-2017"d&lt;BR /&gt;MLOGIC(NEW): Parameter MONTHS1 has value Jul16&lt;BR /&gt;&lt;STRONG&gt;ERROR: More positional parameters found than defined.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you notice the months1 macro only takes the first value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 11:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393841#M25378</guid>
      <dc:creator>Lopa2016</dc:creator>
      <dc:date>2017-09-07T11:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro Errors</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393844#M25379</link>
      <description>&lt;P&gt;This is your problem:&lt;/P&gt;
&lt;P&gt;%let months =Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just put that text into your macro call:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%new(&amp;amp;dsn,&amp;amp;start_month,&amp;amp;END_month,Jul16,Aug16,Sep16,Oct16,Nov16,Dec16,Jan17,Feb17,Mar17,Apr17,May17,Jun17,Jul17);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Lots more paramters than expected. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As with anything like this, is is bad data modelling that has got your into this situation. &amp;nbsp;I am guessing from the _name_ that your doing some sort of proc transpose on the data. &amp;nbsp;Don't. &amp;nbsp;Unless that data is being used for a report and only a report, keep your data normalised - i.e. going down the page. &amp;nbsp;It is so much easier to program and use. &amp;nbsp;If you continue down this route, your code will be a mess, but it is possible with %nstr() and such like functions to mask the character string. &amp;nbsp;E.g.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%new(&amp;amp;dsn,&amp;amp;start_month,&amp;amp;END_month,%nstr(&amp;amp;months));&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 12:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393844#M25379</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-07T12:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro Errors</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393845#M25380</link>
      <description>Thanks. This is entirely for the purpose of building a report.However, %nrstr also doesn't solve this</description>
      <pubDate>Thu, 07 Sep 2017 12:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393845#M25380</guid>
      <dc:creator>Lopa2016</dc:creator>
      <dc:date>2017-09-07T12:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro Errors</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393847#M25381</link>
      <description>&lt;P&gt;So if this is for a report, why are we talking about this code at all:&lt;/P&gt;
&lt;PRE&gt;proc transpose data=have out=want;
  by id id2;
  var xyz;
  idlabel monthvar;
run;

proc report data=want;
  columns _name_ var:;
run;
&lt;/PRE&gt;
&lt;P&gt;The proc transpose creates a transposed dataset with xyz going across, with each variable named varX where X is an incremental number and month as label, e.g.&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; ID2 &amp;nbsp; &amp;nbsp;VAR1 (Jan16) VAR2 (Mar16)....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this way you don't need the list of months, and can use shortcuts like var: i.e. all variables with var prefix. &amp;nbsp;Much simpler.&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;However, %nrstr also doesn't solve this" - this doesn't really tell me anything. &amp;nbsp;Here is a working version:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;%macro tmp (a=);
  %local tmp;
  %let tmp=%sysfunc(tranwrd(&amp;amp;a.,|,%str(,)));
  %put &amp;amp;tmp.;
%mend tmp;

%let list=abc|def|ghi;

%tmp(a=%str(&amp;amp;list.));&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 12:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Macro-Errors/m-p/393847#M25381</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-07T12:29:23Z</dc:date>
    </item>
  </channel>
</rss>

