<?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: Macro error in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569763#M11862</link>
    <description>&lt;P&gt;Why are you putting spaces into to your macro variables if you don't want them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint ;
select Month,Year
  into :Mnth trimmed
     , :Yr trimmed
  from Input
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jun 2019 12:52:13 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-06-28T12:52:13Z</dc:date>
    <item>
      <title>Macro error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569695#M11850</link>
      <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to creating the monthly table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;something like work. test_052019&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;used code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test_&amp;amp;mnth&amp;amp;yr;&lt;BR /&gt;set test_Add;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But getting below error&amp;nbsp;&lt;BR /&gt;22&lt;BR /&gt;__&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;, _DATA_, _LAST_, _NULL_.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;Used below code for macro&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month is $2&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sql noprint ;&lt;BR /&gt;select distinct Month into : Month&lt;BR /&gt;from Input;&lt;BR /&gt;quit;&lt;BR /&gt;%let mnth = %qtrim(&amp;amp;Month);&lt;BR /&gt;%put &amp;amp;mnth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Year is numeric&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sql noprint ;&lt;BR /&gt;select distinct Year into : Year&lt;BR /&gt;from Input;&lt;BR /&gt;quit;&lt;BR /&gt;%let yr = %qtrim(&amp;amp;Year);&lt;BR /&gt;%put &amp;amp;yr ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help, please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 04:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569695#M11850</guid>
      <dc:creator>meckarthik</dc:creator>
      <dc:date>2019-06-28T04:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569697#M11851</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    call symputx('mnth', put(month(today()), z2.));
    call symputx('yr', year(today()));
run;

%put &amp;amp;mnth. &amp;amp;yr.;

data test_&amp;amp;mnth.&amp;amp;yr.;
    a=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 05:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569697#M11851</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-28T05:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569698#M11852</link>
      <description>&lt;P&gt;Please post the whole log of the failing step.&lt;/P&gt;
&lt;P&gt;Use the {i} button for posting the log, so that the horizontal positions and all conent are kept unchanged.&lt;/P&gt;
&lt;P&gt;The ERROR message alone, without the corresponding code, is mostly useless.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 05:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569698#M11852</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-28T05:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569755#M11861</link>
      <description>&lt;P&gt;Several items stand out about your post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are you using %QTRIM?&amp;nbsp; If you want to eliminate leading and trailing blanks, you can use simply:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mnth = &amp;amp;month;&lt;/P&gt;
&lt;P&gt;%let yr = &amp;amp;year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adding quoting characters can only cause trouble in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly, you would be better off creating test_201905 instead of test_052019.&amp;nbsp; That way, when you have created a series of data sets that span multiple years, the data set names will alphabetize in order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third, you should be using this statement if you are trying to debug the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options mprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way, you can see the SAS code generated by any macros you execute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, have you examined your macro variables?&amp;nbsp; SELECT DISTINCT can be extracting more than one distinct value.&amp;nbsp; Are you sure that the values you are extracting are the correct ones?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 12:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569755#M11861</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-28T12:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569763#M11862</link>
      <description>&lt;P&gt;Why are you putting spaces into to your macro variables if you don't want them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint ;
select Month,Year
  into :Mnth trimmed
     , :Yr trimmed
  from Input
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 12:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-error/m-p/569763#M11862</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-28T12:52:13Z</dc:date>
    </item>
  </channel>
</rss>

