<?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: How Can I Display Updated Macro Variable Value, Earlier in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761630#M241032</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/204979"&gt;@KentaMURANAKA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data_null__-san &amp;amp; Tom-san:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for quick reply.&lt;/P&gt;
&lt;P&gt;I said, this problem might be from the timing at which %PUT subimitted, but it was my mistake. I didn't notice CALL SYMPUTX stored macro variable at only DATA step end (maybe).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my actual case, I had used %DO loops in DATA step, and I wanted to display macro variable at each loop. And this issue occurred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks anyway!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't use a %DO loop&lt;STRONG&gt; IN&lt;/STRONG&gt; a data step.&lt;/P&gt;
&lt;P&gt;You can use a %DO loop to &lt;STRONG&gt;generate&lt;/STRONG&gt; part of a data step.&amp;nbsp; For example in this code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  x=5;
%do i=1 to 3 ;
  y&amp;amp;i = x;
%end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro code executes first and then SAS will have this program code to run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  x=5;
y1=x;
y2=x;
y3=x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Aug 2021 01:31:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-08-15T01:31:56Z</dc:date>
    <item>
      <title>How Can I Display Updated Macro Variable Value, Earlier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761573#M241009</link>
      <description>&lt;P&gt;Hi, All:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about how to display macro variable value. Example is below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let val=100;

data test;
    x=50;
    call symputx("val", x);
    %put NotUpdated? = &amp;amp;val.;
run;
%put Updated = &amp;amp;val.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In my actual situation, I want to display updated value to SAS log, before DATA step completed.&lt;/P&gt;&lt;P&gt;I think, this problem is caused by the timing at which %PUT statement submitted, but I have no ideas to resolve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is welcome. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Aug 2021 12:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761573#M241009</guid>
      <dc:creator>KentaMURANAKA</dc:creator>
      <dc:date>2021-08-14T12:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Display Updated Macro Variable Value, Earlier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761574#M241010</link>
      <description>&lt;P&gt;You can use SYMGET to retrieve the value.&amp;nbsp; But why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   x=50;
   call symputx("val", x);
   val=symgetn('val');
   put val=;
   run;
%put Updated = &amp;amp;val.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Aug 2021 13:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761574#M241010</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2021-08-14T13:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Display Updated Macro Variable Value, Earlier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761595#M241014</link>
      <description>&lt;P&gt;If you want to show the value you are putting into the macro variable just do that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   x=50;
   call symputx("val", x);
   put 'NOTE: Macro variable VAL was set to ' x ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Aug 2021 17:29:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761595#M241014</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-14T17:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Display Updated Macro Variable Value, Earlier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761621#M241029</link>
      <description>&lt;P&gt;data_null__-san &amp;amp; Tom-san:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for quick reply.&lt;/P&gt;&lt;P&gt;I said, this problem might be from the timing at which %PUT subimitted, but it was my mistake. I didn't notice CALL SYMPUTX stored macro variable at only DATA step end (maybe).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my actual case, I had used %DO loops in DATA step, and I wanted to display macro variable at each loop. And this issue occurred.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway!&lt;/P&gt;</description>
      <pubDate>Sat, 14 Aug 2021 23:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761621#M241029</guid>
      <dc:creator>KentaMURANAKA</dc:creator>
      <dc:date>2021-08-14T23:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Display Updated Macro Variable Value, Earlier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761630#M241032</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/204979"&gt;@KentaMURANAKA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data_null__-san &amp;amp; Tom-san:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for quick reply.&lt;/P&gt;
&lt;P&gt;I said, this problem might be from the timing at which %PUT subimitted, but it was my mistake. I didn't notice CALL SYMPUTX stored macro variable at only DATA step end (maybe).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my actual case, I had used %DO loops in DATA step, and I wanted to display macro variable at each loop. And this issue occurred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks anyway!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't use a %DO loop&lt;STRONG&gt; IN&lt;/STRONG&gt; a data step.&lt;/P&gt;
&lt;P&gt;You can use a %DO loop to &lt;STRONG&gt;generate&lt;/STRONG&gt; part of a data step.&amp;nbsp; For example in this code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  x=5;
%do i=1 to 3 ;
  y&amp;amp;i = x;
%end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro code executes first and then SAS will have this program code to run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  x=5;
y1=x;
y2=x;
y3=x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 01:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-Can-I-Display-Updated-Macro-Variable-Value-Earlier/m-p/761630#M241032</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-15T01:31:56Z</dc:date>
    </item>
  </channel>
</rss>

