<?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 using Macro variable to create dataset name does not work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291261#M60346</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me understanding why One code does not work , but the other code with similar logic works ? I have also written the changes that makes difference&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;Not Working CODE :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;%LET list=1000,2000;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;options mlogic mprint symbolgen;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%macro Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let i=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%do %while (%qscan(%superq(list), &amp;amp;i, %str(, )) ne );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let Formulary_ID=%qscan(%superq(list), &amp;amp;i, %str(, ));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%if &amp;amp;Formulary_ID=1000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%if &amp;amp;Formulary_ID=2000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;Formulary_ID;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%macro report_summarize ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;CREATE TABLE &amp;amp;Summary AS &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SELECT '1' as test1, '2' as test2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;FROM &amp;amp;formulary &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;where ID=&amp;amp;Formulary_ID.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;group by x ,y &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%mend report_summarize;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;/* Call to Report Summarization Macro */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;%report_summarize();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let i=%eval(&amp;amp;i+1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%mend Formulary;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%Formulary ();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;Not Working Code LOG :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %DO %WHILE(%qscan(%superq(list), &amp;amp;i, &amp;#1;&amp;#30; &amp;#2;) ne) loop beginning; condition is TRUE. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %LET (variable name is FORMULARY_ID)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=1000 is TRUE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=2000 is FALSE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(REPORT_SUMMARIZE): Beginning execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable SUMMARY resolves to SASUSER.SUMMARY&amp;amp;Formulary_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;NOTE: Line generated by the macro variable "FORMULARY_ID".&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;51 SASUSER.SUMMARY1000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;____&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;22&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;____&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY resolves to SASUSER.Formulary&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): CREATE TABLE SASUSER.SUMMARY1000 AS SELECT '1' as test1, '2' as test2 FROM SASUSER.Formulary where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;ID=1000 group by x ,y having z not in ('6') ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4" color="#FF6600"&gt;ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4" color="#FF6600"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(REPORT_SUMMARIZE): Ending execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="6" color="#339966"&gt;&lt;STRONG&gt;working code :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%LET list=1000,2000;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;options mlogic mprint symbolgen;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%macro Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%let i=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%do %while (%qscan(%superq(list), &amp;amp;i, %str(, )) ne );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%let Formulary_ID=%qscan(%superq(list), &amp;amp;i, %str(, ));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%if &amp;amp;Formulary_ID=1000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%if &amp;amp;Formulary_ID=2000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;i;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%macro report_summarize ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;CREATE TABLE &amp;amp;Summary AS &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SELECT '1' as test1, '2' as test2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;FROM &amp;amp;formulary &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;where ID=&amp;amp;Formulary_ID.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;group by x ,y &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%mend report_summarize;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;/* Call to Report Summarization Macro */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%report_summarize();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%let i=%eval(&amp;amp;i+1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%mend Formulary;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%Formulary ();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Working Code Log :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): Beginning execution.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %LET (variable name is I)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %DO %WHILE(%qscan(%superq(list), &amp;amp;i, &amp;#1;&amp;#30; &amp;#2;) ne) loop beginning; condition is TRUE. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %LET (variable name is FORMULARY_ID)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=1000 is TRUE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=2000 is FALSE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(REPORT_SUMMARIZE): Beginning execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable SUMMARY resolves to SASUSER.SUMMARY1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY resolves to SASUSER.Formulary&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): CREATE TABLE SASUSER.SUMMARY1 AS SELECT '1' as test1, '2' as test2 FROM SASUSER.Formulary where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;ID=1000 group by group by x ,y having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;WARNING: A GROUP BY clause has been transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;clause of the associated table-expression referenced a summary function.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;NOTE: The query as specified involves ordering by an item that doesn't appear in its SELECT clause.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;NOTE: Table SASUSER.SUMMARY1 created, with 9150 rows and 2 columns.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): QUIT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;Changes&amp;nbsp;that made it work .&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;Formulary_ID;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;to&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;i;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;Any insights on why the above code failed would be highly appreciated .&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;M&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>Fri, 12 Aug 2016 14:24:53 GMT</pubDate>
    <dc:creator>mgorripati</dc:creator>
    <dc:date>2016-08-12T14:24:53Z</dc:date>
    <item>
      <title>using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291261#M60346</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me understanding why One code does not work , but the other code with similar logic works ? I have also written the changes that makes difference&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;Not Working CODE :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;%LET list=1000,2000;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;options mlogic mprint symbolgen;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%macro Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let i=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%do %while (%qscan(%superq(list), &amp;amp;i, %str(, )) ne );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let Formulary_ID=%qscan(%superq(list), &amp;amp;i, %str(, ));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%if &amp;amp;Formulary_ID=1000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%if &amp;amp;Formulary_ID=2000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;Formulary_ID;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%macro report_summarize ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;CREATE TABLE &amp;amp;Summary AS &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SELECT '1' as test1, '2' as test2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;FROM &amp;amp;formulary &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;where ID=&amp;amp;Formulary_ID.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;group by x ,y &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%mend report_summarize;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;/* Call to Report Summarization Macro */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;%report_summarize();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%let i=%eval(&amp;amp;i+1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%mend Formulary;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;%Formulary ();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;Not Working Code LOG :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %DO %WHILE(%qscan(%superq(list), &amp;amp;i, &amp;#1;&amp;#30; &amp;#2;) ne) loop beginning; condition is TRUE. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %LET (variable name is FORMULARY_ID)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=1000 is TRUE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=2000 is FALSE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(REPORT_SUMMARIZE): Beginning execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable SUMMARY resolves to SASUSER.SUMMARY&amp;amp;Formulary_ID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;NOTE: Line generated by the macro variable "FORMULARY_ID".&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;51 SASUSER.SUMMARY1000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;____&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;22&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;____&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY resolves to SASUSER.Formulary&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#FF6600"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): CREATE TABLE SASUSER.SUMMARY1000 AS SELECT '1' as test1, '2' as test2 FROM SASUSER.Formulary where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;ID=1000 group by x ,y having z not in ('6') ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4" color="#FF6600"&gt;ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4" color="#FF6600"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MPRINT(REPORT_SUMMARIZE): QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;MLOGIC(REPORT_SUMMARIZE): Ending execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="6" color="#339966"&gt;&lt;STRONG&gt;working code :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%LET list=1000,2000;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;options mlogic mprint symbolgen;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%macro Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%let i=1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%do %while (%qscan(%superq(list), &amp;amp;i, %str(, )) ne );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%let Formulary_ID=%qscan(%superq(list), &amp;amp;i, %str(, ));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%if &amp;amp;Formulary_ID=1000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%if &amp;amp;Formulary_ID=2000 %THEN &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;i;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%macro report_summarize ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;CREATE TABLE &amp;amp;Summary AS &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SELECT '1' as test1, '2' as test2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;FROM &amp;amp;formulary &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;where ID=&amp;amp;Formulary_ID.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;group by x ,y &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;QUIT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%mend report_summarize;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;/* Call to Report Summarization Macro */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%report_summarize();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%let i=%eval(&amp;amp;i+1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%mend Formulary;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;%Formulary ();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Working Code Log :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;%Formulary ();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): Beginning execution.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %LET (variable name is I)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %DO %WHILE(%qscan(%superq(list), &amp;amp;i, &amp;#1;&amp;#30; &amp;#2;) ne) loop beginning; condition is TRUE. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %LET (variable name is FORMULARY_ID)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable I resolves to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=1000 is TRUE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(FORMULARY): %IF condition &amp;amp;Formulary_ID=2000 is FALSE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MLOGIC(REPORT_SUMMARIZE): Beginning execution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): PROC SQL;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable SUMMARY resolves to SASUSER.SUMMARY1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY resolves to SASUSER.Formulary&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Macro variable FORMULARY_ID resolves to 1000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): CREATE TABLE SASUSER.SUMMARY1 AS SELECT '1' as test1, '2' as test2 FROM SASUSER.Formulary where &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;ID=1000 group by group by x ,y having z not in ('6') ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;WARNING: A GROUP BY clause has been transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;clause of the associated table-expression referenced a summary function.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;NOTE: The query as specified involves ordering by an item that doesn't appear in its SELECT clause.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;NOTE: Table SASUSER.SUMMARY1 created, with 9150 rows and 2 columns.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;MPRINT(REPORT_SUMMARIZE): QUIT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;Changes&amp;nbsp;that made it work .&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;Formulary_ID;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;to&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;%LET Summary=SASUSER.SUMMARY&amp;amp;i;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;Any insights on why the above code failed would be highly appreciated .&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;M&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>Fri, 12 Aug 2016 14:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291261#M60346</guid>
      <dc:creator>mgorripati</dc:creator>
      <dc:date>2016-08-12T14:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291264#M60348</link>
      <description>&lt;P&gt;Rather than colour, you can use the little running man icon or {I} to include code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291264#M60348</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-12T14:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291277#M60354</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I am not going to look in depth at that code. &amp;nbsp;My first question is going to be why you are doing all that. &amp;nbsp;What is your source data and what do you want out? &amp;nbsp;Why, well a simple glance over the code - you are looping over a list of values. &amp;nbsp;Datastep language has do loops for this purpose, you then have all kinds of macro gubbins to arrive at a dataset name, why can this not be done in datastep? &amp;nbsp;Sasuser is not generally a good place to store things. &amp;nbsp;For the looping, you seem to be using a where clause with a group by - this does not work. &amp;nbsp;Also, why not just group by the loop group as well? &amp;nbsp;So, a good starting point is to post some test data - in the form of a datastep - with your starting data, and a breif image of what you want the output to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also to note, there are various typos in that code, for instance there are two %if %then statements that don't actually do anything:&lt;BR /&gt; %if &amp;amp;Formulary_ID=1000 %THEN &lt;BR /&gt; %if &amp;amp;Formulary_ID=2000 %THEN &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291277#M60354</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-12T14:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291280#M60355</link>
      <description>&lt;P&gt;SQL is notorious for failing to unquote characters in time to correctly parse them. &amp;nbsp;I would try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let summary = %unquote(sasuser.summary&amp;amp;Formulary_id);&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291280#M60355</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-12T14:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291282#M60357</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your comments . My original code is over 1200 lines . I have only posted the code that is just enough to explain &amp;nbsp;the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My program generates excel files with metrics .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I loop through each ID (1000,2000 etc..) and calculate metrics using proc sql and datastep with in a macro &amp;nbsp;for each ID and generate a excel report using PROC REPORT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hit a&amp;nbsp;road block reading the macro varibles sepearated by comma and using them as a part of datasetname.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291282#M60357</guid>
      <dc:creator>mgorripati</dc:creator>
      <dc:date>2016-08-12T14:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291284#M60358</link>
      <description>&lt;P&gt;Looks to me like you are confusing the SAS parser with your macro quoting. &amp;nbsp;I would remove the macro quoting here since a valid value for a SAS dataset cannot include any characters that need macro quoting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET Summary=%unquote(SASUSER.SUMMARY&amp;amp;Formulary_ID);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291284#M60358</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-08-12T14:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291290#M60361</link>
      <description>&lt;P&gt;Thanks, that solves the issue.&amp;nbsp;I need to learn a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 15:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291290#M60361</guid>
      <dc:creator>mgorripati</dc:creator>
      <dc:date>2016-08-12T15:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: using Macro variable to create dataset name does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291291#M60362</link>
      <description>&lt;P&gt;thanks tom.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 15:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Macro-variable-to-create-dataset-name-does-not-work/m-p/291291#M60362</guid>
      <dc:creator>mgorripati</dc:creator>
      <dc:date>2016-08-12T15:11:28Z</dc:date>
    </item>
  </channel>
</rss>

