<?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 SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229404#M41516</link>
    <description>&lt;P&gt;Your code as shown works fine.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lib=sashelp;
%let dsname=class;
%macro test;
  data test11;
    set &amp;amp;lib..&amp;amp;dsname.; 
  run;
%mend;
%test;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MLOGIC(TEST):  Beginning execution.
MPRINT(TEST):   data test11;
SYMBOLGEN:  Macro variable LIB resolves to sashelp
SYMBOLGEN:  Macro variable DSNAME resolves to class
MPRINT(TEST):   set sashelp.class;
MPRINT(TEST):   run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST11 has 19 observations and 5 variables.
NOTE: DATA statement used:
      real time           0.01 seconds
      cpu time            0.00 seconds


MLOGIC(TEST):  Ending execution.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I suspect you are doing something different and your macro values are quoted. Try using the %unquote() function.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Oct 2015 04:35:03 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2015-10-10T04:35:03Z</dc:date>
    <item>
      <title>Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229403#M41515</link>
      <description>&lt;P&gt;I am trying to write a program involving a macro, and it fails at a very initial stage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;P&gt;options symbolgen mprint mlogic;&lt;/P&gt;
&lt;P&gt;%let lib=aa_temp1;&lt;/P&gt;
&lt;P&gt;%let dsname=Party_Details;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test11;&lt;/P&gt;
&lt;P&gt;set &amp;amp;lib..&amp;amp;dsname.;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;%test();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Error when executed:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SYMBOLGEN: Macro variable lib resolves to aa_temp1&lt;/P&gt;
&lt;P&gt;SYMBOLGEN; Macro variable dsname resolves to Party_Details&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test11;&amp;nbsp; set &amp;amp;lib..&amp;amp;dsname.;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or used out of proper order.&lt;/P&gt;
&lt;P&gt;MPRIINT(TEST): Set aa_temp1.Party_Details;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried the dsname in Set as &lt;STRONG&gt;&amp;amp;dsname&lt;/STRONG&gt; as well as &lt;STRONG&gt;&amp;amp;dsname. , &lt;/STRONG&gt;and there is the same error. Tried searching for the error, and still not sure why this simple line generates error. What is that I am missing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2015 04:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229403#M41515</guid>
      <dc:creator>zoomzoom</dc:creator>
      <dc:date>2015-10-10T04:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229404#M41516</link>
      <description>&lt;P&gt;Your code as shown works fine.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lib=sashelp;
%let dsname=class;
%macro test;
  data test11;
    set &amp;amp;lib..&amp;amp;dsname.; 
  run;
%mend;
%test;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MLOGIC(TEST):  Beginning execution.
MPRINT(TEST):   data test11;
SYMBOLGEN:  Macro variable LIB resolves to sashelp
SYMBOLGEN:  Macro variable DSNAME resolves to class
MPRINT(TEST):   set sashelp.class;
MPRINT(TEST):   run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST11 has 19 observations and 5 variables.
NOTE: DATA statement used:
      real time           0.01 seconds
      cpu time            0.00 seconds


MLOGIC(TEST):  Ending execution.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I suspect you are doing something different and your macro values are quoted. Try using the %unquote() function.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2015 04:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229404#M41516</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-10-10T04:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229418#M41522</link>
      <description>&lt;P&gt;Yes, please double-check that the code you posted is the same as the code you submitted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that your macro call %test()&amp;nbsp;;&amp;nbsp; has parentheses, even though the macro does not have any parameters.&amp;nbsp; This will create the error message you get, though not near the SET statement.&amp;nbsp; So &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ﻿&lt;/a&gt;'s suggestion about possible macro quoting in your real code is a good one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHen I run your code as is, I get below log:&lt;/P&gt;&lt;PRE&gt;26   %test();
MLOGIC(TEST):  Beginning execution.
MPRINT(TEST):   data test11;
SYMBOLGEN:  Macro variable LIB resolves to aa_temp1
SYMBOLGEN:  Macro variable DSNAME resolves to Party_Details
MPRINT(TEST):   set aa_temp1.Party_Details;
MPRINT(TEST):   run;

NOTE: There were 1 observations read from the data set AA_TEMP1.PARTY_DETAILS.
NOTE: The data set WORK.TEST11 has 1 observations and 1 variables.

MLOGIC(TEST):  Ending execution.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN
      where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Oct 2015 12:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229418#M41522</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-10-10T12:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229444#M41524</link>
      <description>Quentin and Chris,&lt;BR /&gt;&lt;BR /&gt;Thank you for your input. I have closed the session, reopened and executed the same code - and it works now. Atleast I have learnt something new from you two.</description>
      <pubDate>Sat, 10 Oct 2015 16:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/229444#M41524</guid>
      <dc:creator>zoomzoom</dc:creator>
      <dc:date>2015-10-10T16:29:08Z</dc:date>
    </item>
  </channel>
</rss>

