<?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: SELECT INTO within DO loop in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532746#M6079</link>
    <description>&lt;P&gt;I suspect that you may be attempting to use macro variables generated inside your Plot macro after it has executed. By default the maco variables would be local to Plot and not exist outside. Here is an example:&lt;/P&gt;
&lt;PRE&gt;%macro dummy();
proc sql noprint;
  select name into : names separated by " "
  from sashelp.class
  where age=11
  ;
quit;

%put Inside macro dummy names= &amp;amp;names.;
%mend;

%dummy;

%put Outside of macro dummy names= &amp;amp;names.;
&lt;/PRE&gt;
&lt;P&gt;Note the same WARNING you show appearing before the last %put.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this describes your use then one fix would be to add a %global eg1 eg3; statement to the Plot macro definition before assigning the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro variable scope, which this is one example, can be fun to debug.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Feb 2019 21:08:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-02-04T21:08:29Z</dc:date>
    <item>
      <title>SELECT INTO within DO loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532675#M6052</link>
      <description>&lt;P&gt;Hi I am trying to run the codes below, but when I test the macro &amp;amp;resid_eq1 (%put &amp;amp;eq1.), SAS kept giving me this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"WARNING: Apparent symbolic reference EQ1 not resolved."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let PROD = A B C;&lt;BR /&gt;%let ns = %sysfunc(countw(&amp;amp;prod.));&lt;/P&gt;&lt;P&gt;%macro plot;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%local i v1;&lt;BR /&gt;%do i=1 %to &amp;amp;ns.;&lt;BR /&gt;%let v1 = %scan(&amp;amp;prod., &amp;amp;i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _&amp;amp;v1._combined;&lt;BR /&gt;merge &amp;amp;v1._EQ1 (in=a) &amp;amp;v1._EQ3 (in=b);&lt;BR /&gt;if a;&lt;BR /&gt;by date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select Residuals_eq1 into :eq1&lt;BR /&gt;from &amp;amp;v1._EQ1&lt;BR /&gt;having monotonic()=max(monotonic());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select Residuals_eq3 into :eq3&lt;BR /&gt;from &amp;amp;v1._EQ3&lt;BR /&gt;having monotonic()=max(monotonic());&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;%mend plot;&lt;BR /&gt;%plot;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 18:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532675#M6052</guid>
      <dc:creator>tampham92</dc:creator>
      <dc:date>2019-02-04T18:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT INTO within DO loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532680#M6054</link>
      <description>&lt;P&gt;Please post the whole log that results in the WARNING (use the {i} button); I see nothing in your code as posted that could cause the WARNING.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/176468"&gt;@tampham92&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi I am trying to run the codes below, but when I test the macro &amp;amp;resid_eq1 (%put &amp;amp;eq1.), SAS kept giving me this error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"WARNING: Apparent symbolic reference EQ1 not resolved."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let PROD = A B C;&lt;BR /&gt;%let ns = %sysfunc(countw(&amp;amp;prod.));&lt;/P&gt;
&lt;P&gt;%macro plot;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%local i v1;&lt;BR /&gt;%do i=1 %to &amp;amp;ns.;&lt;BR /&gt;%let v1 = %scan(&amp;amp;prod., &amp;amp;i);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _&amp;amp;v1._combined;&lt;BR /&gt;merge &amp;amp;v1._EQ1 (in=a) &amp;amp;v1._EQ3 (in=b);&lt;BR /&gt;if a;&lt;BR /&gt;by date;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select Residuals_eq1 into :eq1&lt;BR /&gt;from &amp;amp;v1._EQ1&lt;BR /&gt;having monotonic()=max(monotonic());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select Residuals_eq3 into :eq3&lt;BR /&gt;from &amp;amp;v1._EQ3&lt;BR /&gt;having monotonic()=max(monotonic());&lt;/P&gt;
&lt;P&gt;%end;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;%mend plot;&lt;BR /&gt;%plot;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 19:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532680#M6054</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-04T19:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT INTO within DO loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532681#M6055</link>
      <description>&lt;P&gt;Here it is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;25 GOPTIONS ACCESSIBLE;&lt;BR /&gt;26 %macro plot;&lt;BR /&gt;27&lt;BR /&gt;28 %local i v1;&lt;BR /&gt;29 %do i=1 %to &amp;amp;ns.;&lt;BR /&gt;30 %let v1 = %scan(&amp;amp;prod., &amp;amp;i);&lt;BR /&gt;31&lt;BR /&gt;32&lt;BR /&gt;33&lt;BR /&gt;34 data _&amp;amp;v1._combined;&lt;BR /&gt;35 merge &amp;amp;v1._EQ1 (in=a) &amp;amp;v1._EQ3 (in=b);&lt;BR /&gt;36 if a;&lt;BR /&gt;37 by date;&lt;BR /&gt;38 run;&lt;BR /&gt;39&lt;BR /&gt;40&lt;BR /&gt;41&lt;BR /&gt;42 proc sql;&lt;BR /&gt;43 select Residuals_eq1 into :eq1&lt;BR /&gt;44 from &amp;amp;v1._EQ1&lt;BR /&gt;45 having monotonic()=max(monotonic());&lt;BR /&gt;46&lt;BR /&gt;47&lt;BR /&gt;48&lt;BR /&gt;49 select Residuals_eq3 into :eq3&lt;BR /&gt;50 from &amp;amp;v1._EQ3&lt;BR /&gt;51 having monotonic()=max(monotonic());&lt;BR /&gt;52&lt;BR /&gt;53 %end;&lt;BR /&gt;54 quit;&lt;BR /&gt;55&lt;BR /&gt;56 %mend plot;&lt;BR /&gt;2 The SAS System 13:58 Monday, February 4, 2019&lt;/P&gt;&lt;P&gt;57 %plot;&lt;/P&gt;&lt;P&gt;NOTE: There were 186 observations read from the data set WORK.A_EQ1.&lt;BR /&gt;NOTE: There were 186 observations read from the data set WORK.A_EQ3.&lt;BR /&gt;NOTE: The data set WORK.A_COMBINED has 186 observations and 7 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;58&lt;BR /&gt;59 %put &amp;amp;eq1. &amp;amp;eq3.;&lt;BR /&gt;WARNING: Apparent symbolic reference EQ1 not resolved.&lt;BR /&gt;WARNING: Apparent symbolic reference EQ3 not resolved.&lt;BR /&gt;&amp;amp;eq1. &amp;amp;eq3.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 19:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532681#M6055</guid>
      <dc:creator>tampham92</dc:creator>
      <dc:date>2019-02-04T19:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT INTO within DO loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532746#M6079</link>
      <description>&lt;P&gt;I suspect that you may be attempting to use macro variables generated inside your Plot macro after it has executed. By default the maco variables would be local to Plot and not exist outside. Here is an example:&lt;/P&gt;
&lt;PRE&gt;%macro dummy();
proc sql noprint;
  select name into : names separated by " "
  from sashelp.class
  where age=11
  ;
quit;

%put Inside macro dummy names= &amp;amp;names.;
%mend;

%dummy;

%put Outside of macro dummy names= &amp;amp;names.;
&lt;/PRE&gt;
&lt;P&gt;Note the same WARNING you show appearing before the last %put.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this describes your use then one fix would be to add a %global eg1 eg3; statement to the Plot macro definition before assigning the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro variable scope, which this is one example, can be fun to debug.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 21:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532746#M6079</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-04T21:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT INTO within DO loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532754#M6081</link>
      <description>&lt;P&gt;Macro variables created&amp;nbsp;&lt;EM&gt;in&lt;/EM&gt; a macro end up in the local symbol table and are therefore not available&amp;nbsp;&lt;EM&gt;outside&lt;/EM&gt; the macro.&lt;/P&gt;
&lt;P&gt;And make sure that your "having" clause gives you a result.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 21:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SELECT-INTO-within-DO-loop/m-p/532754#M6081</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-04T21:25:06Z</dc:date>
    </item>
  </channel>
</rss>

