<?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: help on macro in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182371#M46443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agree with _null_ , seems like an odd design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said, would expect the cause is a problem of macro processor not %unquoting the value of &amp;amp;var1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming varlist is just a space-delimited list of variable names, you could change %qscan to %scan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Jan 2015 14:26:21 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2015-01-14T14:26:21Z</dc:date>
    <item>
      <title>help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182369#M46441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;I am looping symput in a macro with a list of selected variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;I have no problem run the symput command outside the macro; But when I put it in the macro, it always report error. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;%marcro( varlist=,…….)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;%let var1&amp;nbsp;&amp;nbsp; = %qscan(&amp;amp;varlist, i)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;………&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;%do %while(…….);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 12.0pt; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 12.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a1 &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=no_more;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; symput( &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'MU'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;||left(_N_), &amp;amp;var1._Mean);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; symput( &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'SD'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;||left(_N_), &amp;amp;var1._stdDev&amp;nbsp; );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; no_more &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'count'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,_n_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 12.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;……………..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%end; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%mend; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;Error message like this : &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;NOTE: Line generated by the macro variable "VAR1".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PDT_Vpp_Mean&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt; -----&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt; 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;ERROR 22-322: Syntax error, expecting one of the following: !,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt; !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt; &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt; NG, NL, NOTIN, OR, ^=, |, ||, ~=.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;253: LINE and COLUMN cannot be determined.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;*****************&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;Please advise me how to solve this problem. Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;Andrew&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 13:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182369#M46441</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2015-01-14T13:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182370#M46442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to put so much data into macro variables?&amp;nbsp; Sounds like a bad idea to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Show the data in WORK.A1 you may not need any of the macro bit just better data step.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 14:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182370#M46442</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-14T14:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182371#M46443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agree with _null_ , seems like an odd design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said, would expect the cause is a problem of macro processor not %unquoting the value of &amp;amp;var1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming varlist is just a space-delimited list of variable names, you could change %qscan to %scan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 14:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182371#M46443</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-01-14T14:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182372#M46444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also note that the error is being generated by portions of the code that you did not show us:&amp;nbsp; the ...... following the DATA step.&amp;nbsp; Other than that, I agree with the earlier posters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 14:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182372#M46444</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-01-14T14:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182373#M46445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe I understand where is the problem .&lt;/P&gt;&lt;P&gt;1) don't use quote version macro function if you could .&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;%let var1&amp;nbsp;&amp;nbsp; = %qscan(&amp;amp;varlist, i)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 16px; background-color: #ffffff; font-family: 'Courier New';"&gt;%let var1&amp;nbsp;&amp;nbsp; = %scan(&amp;amp;varlist, i)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 16px; background-color: #ffffff; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 16px; background-color: #ffffff; font-family: 'Courier New';"&gt;2)if you use %qscan() then use %unquote to get rid of mask character around macro variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt; symput( &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'MU'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;||left(_N_), &amp;amp;var1._Mean);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt; symput( &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'MU'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;||left(_N_), &lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;%unquote(&lt;/SPAN&gt;&amp;amp;var1.)_Mean);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Courier New'; color: black; background: white;"&gt;Ksharp&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 15:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182373#M46445</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-14T15:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: help on macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182374#M46446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem was solved by Xia's suggestion!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for suggestions from others as well!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2015 16:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-on-macro/m-p/182374#M46446</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2015-01-14T16:07:47Z</dc:date>
    </item>
  </channel>
</rss>

