<?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 variables display in sql code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/700026#M214191</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44256"&gt;@mmkr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It is not working if we remove %macro ,could you please let me know if we have any other option ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No other option that I know of. Why would having working code inside a macro be a problem that has to be avoided with some other solution?&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2020 22:41:51 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-11-18T22:41:51Z</dc:date>
    <item>
      <title>Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699929#M214136</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;When i use macro variables inside the sql i can see the values in log if i use symbol gen&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Isn't there a way to see it in the SQL? like expected output below ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;input :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;%let test=abc;
&lt;DIV&gt;%let test2=xyz;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;data ds;&lt;/DIV&gt;
&lt;DIV&gt;x=1;&lt;/DIV&gt;
&lt;DIV&gt;y=2;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;options symbolgen;&lt;/DIV&gt;
&lt;DIV&gt;proc sql;&lt;/DIV&gt;
&lt;DIV&gt;create table &amp;amp;test._&amp;amp;test2. as&lt;/DIV&gt;
&lt;DIV&gt;select *&lt;/DIV&gt;
&lt;DIV&gt;from ds;&lt;/DIV&gt;
quit;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Log;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;40 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; options symbolgen;
&lt;DIV&gt;41 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proc sql;&lt;/DIV&gt;
&lt;DIV&gt;42 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; create table &amp;amp;test._&amp;amp;test2. as&lt;/DIV&gt;
&lt;DIV&gt;SYMBOLGEN: &amp;nbsp;Macro variable TEST resolves to abc&lt;/DIV&gt;
&lt;DIV&gt;SYMBOLGEN: &amp;nbsp;Macro variable TEST2 resolves to xyz&lt;/DIV&gt;
&lt;DIV&gt;43 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select *&lt;/DIV&gt;
44 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from ds;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Expected output :&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Isn't there a way to see it in the SQL?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;proc sql&lt;/DIV&gt;
&lt;DIV&gt;create table abc_xyz as&lt;/DIV&gt;
&lt;DIV&gt;seelct *&lt;/DIV&gt;
&lt;DIV&gt;from ds;&lt;/DIV&gt;
&lt;DIV&gt;quit;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699929#M214136</guid>
      <dc:creator>mmkr</dc:creator>
      <dc:date>2020-11-18T18:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699937#M214139</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro dothis;
    %let test=abc;
    %let test2=xyz;
 
    data ds;
        x=1;
        y=2;
    run;
    proc sql;
        create table &amp;amp;test._&amp;amp;test2. as select * from ds;
    quit;
%mend;
options mprint;
%dothis&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699937#M214139</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-18T18:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699959#M214149</link>
      <description>&lt;P&gt;Thank you !!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Does that work if we eliminate the macro as well?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 19:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699959#M214149</guid>
      <dc:creator>mmkr</dc:creator>
      <dc:date>2020-11-18T19:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699960#M214150</link>
      <description>&lt;P&gt;It is not working if we remove %macro ,could you please let me know if we have any other option ?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 19:13:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699960#M214150</guid>
      <dc:creator>mmkr</dc:creator>
      <dc:date>2020-11-18T19:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699962#M214151</link>
      <description>&lt;P&gt;If you want to see the value in the log use the %PUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=test &amp;amp;=test2 ;
proc sql;
create table &amp;amp;test._&amp;amp;test2. as
select *
from ds;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt;&amp;nbsp;In this case you don't really need to see the value of the macro variables because the NOTE in the SAS log about the dataset being created will include the name of the dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 19:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/699962#M214151</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-18T19:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables display in sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/700026#M214191</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44256"&gt;@mmkr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It is not working if we remove %macro ,could you please let me know if we have any other option ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No other option that I know of. Why would having working code inside a macro be a problem that has to be avoided with some other solution?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 22:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-display-in-sql-code/m-p/700026#M214191</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-18T22:41:51Z</dc:date>
    </item>
  </channel>
</rss>

