<?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 variable generating error when calling list in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895171#M353633</link>
    <description>&lt;P&gt;You need to use the macro language to generate valid SAS language statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You set the macro LIST to the string&lt;/P&gt;
&lt;PRE&gt;apple,  bee, church&lt;/PRE&gt;
&lt;P&gt;And then you used it this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= &amp;amp;List.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which means you tried to run this SAS statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= apple,  bee, church;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And that is NOT a valid SAS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What would be a valid SAS statement?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= "apple,  bee, church";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;How could you change your macro code so it produces that statement?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= "&amp;amp;List.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
    <pubDate>Thu, 21 Sep 2023 03:40:09 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-09-21T03:40:09Z</dc:date>
    <item>
      <title>Macro variable generating error when calling list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895165#M353632</link>
      <description>&lt;P&gt;I am trying to put the words from the List macro into the Objects column in specific scenarios.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an excerpt of the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let A= 16;
%let List= %str(apple,  bee, church)
%put List= &amp;amp;List.;
OPTIONS MPRINT SYMBOLGEN MLOGIC;
data want; set have;
if C= "Yes" then 
do;
Count = &amp;amp;A.;
Objects= &amp;amp;List.;
end;
run;
proc print data= want (obs=10); run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;SYMBOLGEN says that the macro resolves correctly but I get this error when I run my code and the Objects column is not populated:&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "List".&lt;BR /&gt;1 apple, bee, church&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;-&lt;BR /&gt;76&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: (, [, {&lt;/P&gt;&lt;P&gt;The under scores are on the comma after the first word.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight or possible solutions are appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 03:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895165#M353632</guid>
      <dc:creator>Valeidoscope</dc:creator>
      <dc:date>2023-09-21T03:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable generating error when calling list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895171#M353633</link>
      <description>&lt;P&gt;You need to use the macro language to generate valid SAS language statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You set the macro LIST to the string&lt;/P&gt;
&lt;PRE&gt;apple,  bee, church&lt;/PRE&gt;
&lt;P&gt;And then you used it this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= &amp;amp;List.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which means you tried to run this SAS statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= apple,  bee, church;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And that is NOT a valid SAS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What would be a valid SAS statement?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= "apple,  bee, church";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;How could you change your macro code so it produces that statement?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Objects= "&amp;amp;List.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 21 Sep 2023 03:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895171#M353633</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-21T03:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable generating error when calling list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895248#M353686</link>
      <description>&lt;P&gt;That worked, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 12:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-generating-error-when-calling-list/m-p/895248#M353686</guid>
      <dc:creator>Valeidoscope</dc:creator>
      <dc:date>2023-09-21T12:59:53Z</dc:date>
    </item>
  </channel>
</rss>

