<?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: Is it possible to resolve a macro variable? in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813377#M507</link>
    <description>&lt;P&gt;Please explain WHAT you are trying to do?&lt;/P&gt;
&lt;P&gt;Is the goal to create a file name of&amp;nbsp;SALES12103.log from the separated pieces SALES, 12103, and .log ?&lt;/P&gt;
&lt;P&gt;Then why not just DO that.&lt;/P&gt;
&lt;P&gt;So let's start by initializing your input macro variables,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DIRNME=c:\downloads;
%let PNME=SALES ;
%let P1YYMM1=12103;
%let I=1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now we can use them to generate a new macro variable with the name you want.&amp;nbsp; Let's call it LOGNAME.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let logname=&amp;amp;DirNme.\LOGS;
%let logname=&amp;amp;logname\&amp;amp;pnme;
%let logname=&amp;amp;logname.&amp;amp;&amp;amp;p1yymm&amp;amp;i;
%let logname=&amp;amp;logname..log;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;435  %put &amp;amp;=logname;
LOGNAME=c:\downloads\LOGS\SALES12103.log
&lt;/PRE&gt;
&lt;P&gt;Now just use that in your macro call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%StrLog
(PName=%str(&amp;amp;PName )
,PrinttoName = &amp;amp;logname 
,ClearLog=N
); &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 15 May 2022 16:24:36 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-15T16:24:36Z</dc:date>
    <item>
      <title>Is it possible to resolve a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813362#M504</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;This might look silly, but i am not able to resolve a Macro variable. I am trying to create log files for a program and running it in the loop for mult&lt;A href="https://www.playboimerch.com/whole-lotta-red" target="_self"&gt;i&lt;/A&gt;ple dates for a single .sas program. Kindly suggest me on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let tst = t1; /*for testing purpose&lt;A href="https://www.playboimerch.com/caps/" target="_self"&gt;*&lt;/A&gt;/ /*StrLog Macro creates the log file at the give location in the macro var dirname*/ %StrLog(PName=%str(&amp;amp;PName ),PrinttoName = %str(&amp;amp;DirNme.\LOGS\&amp;amp;PName .&amp;amp;&amp;amp;Pg1YYMM&amp;amp;i.&amp;amp;tst..log) , ClearLog=N); LOG : WARNING: Apparent symbolic reference P1YYMM1_T1 not resolved. &amp;amp;P1YYMM1_t1..log If i assign anything to the Macro tst, its not resolving pls check the below. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: Macro variable MNTH1 resolves to 202103 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I re&lt;A href="https://www.playboimerch.com/t-shirts/" target="_self"&gt;s&lt;/A&gt;olve to 1 SYMBOLGEN: Macro variable P1YYMM1 resolves to 12103 SYMBOLGEN: Macro variable PNME resolves to SALES SYMBOLGEN&lt;A href="https://www.playboimerch.com/sweatshirt" target="_self"&gt;:&lt;/A&gt; &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: Macro variable TST resolves to t WARNING: Apparent symbolic reference P1YYMM1T not resolved. ==&amp;gt;&amp;gt; 1 202103 12103 SALES&amp;amp;P&lt;A href="https://www.playboimerch.com/hoodies/" target="_self"&gt;1&lt;/A&gt;YYMM1t..log and if I don't assign anything to the macro variable test it works fine. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN:&lt;/P&gt;&lt;P&gt;The macro variable I resolve to 1 SYMBOLGEN: Macro variable MNTH1 resolves to 202103 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN&lt;A href="https://www.playboimerch.com/vlone-x-playboi-carti" target="_self"&gt;:&lt;/A&gt; Macro variable P1YYMM1 resolves to 12103 SYMBOLGEN: Macro variable PNME resolves to SALES SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN: Macro variable TST resolves to SYMBOLGEN: Macro variable P1YYMM1 resolves to 12103 i&lt;A href="https://www.playboimerch.com/" target="_self"&gt;=&lt;/A&gt;=&amp;gt;&amp;gt; 1 202103 12103 SALES12103.log&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 07:05:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813362#M504</guid>
      <dc:creator>Lusamai</dc:creator>
      <dc:date>2022-05-15T07:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to resolve a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813363#M505</link>
      <description>&lt;P&gt;Please paste code or log text in either a text box, opened on the forum sing the &amp;lt;/&amp;gt; icon, or a code box opened with the "running man" icon.&lt;/P&gt;
&lt;P&gt;That is next to impossible to read or follow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One suspects to have any chance of determining what is incorrect requires:&lt;/P&gt;
&lt;P&gt;1) the entire program code of the macro Strlog&lt;/P&gt;
&lt;P&gt;2) the statement that calls the macro&lt;/P&gt;
&lt;P&gt;3) the values of the macro variables that it seems you may be using for parameters to the macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Style comment: Multiple uses of %str for parameters of a macro means that you may want to reconsider what/how you are passing those values. I pass lots of directory paths and file name constructs without any use of %str. This goes double for indirect macro references, the &amp;amp;&amp;amp; parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Place a %PUT statement or two &lt;STRONG&gt;before&lt;/STRONG&gt; the macro call to show the values of the parameters sent to that macro to verify that what the macro is getting is what you intended.&lt;/P&gt;
&lt;P&gt;If the call to this macro is inside another macro then comment out the call to this macro and just use the %put to see the parameters you are passing. Or perhaps make a stripped version of the looping construct to just generate these the parameters.&lt;/P&gt;
&lt;P&gt;The relative simplicity of Proc Printto, which would be the natural way to address logs, seems like the need for a separate macro to call the Proc would be unlikely and you may be adding complexity not needed.&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/425359"&gt;@Lusamai&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;This might look silly, but i am not able to resolve a Macro variable. I am trying to create log files for a program and running it in the loop for mult&lt;A href="https://www.playboimerch.com/whole-lotta-red" target="_self"&gt;i&lt;/A&gt;ple dates for a single .sas program. Kindly suggest me on this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let tst = t1; /*for testing purpose&lt;A href="https://www.playboimerch.com/caps/" target="_self"&gt;*&lt;/A&gt;/ /*StrLog Macro creates the log file at the give location in the macro var dirname*/ %StrLog(PName=%str(&amp;amp;PName ),PrinttoName = %str(&amp;amp;DirNme.\LOGS\&amp;amp;PName .&amp;amp;&amp;amp;Pg1YYMM&amp;amp;i.&amp;amp;tst..log) , ClearLog=N); LOG : WARNING: Apparent symbolic reference P1YYMM1_T1 not resolved. &amp;amp;P1YYMM1_t1..log If i assign anything to the Macro tst, its not resolving pls check the below. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: Macro variable MNTH1 resolves to 202103 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I re&lt;A href="https://www.playboimerch.com/t-shirts/" target="_self"&gt;s&lt;/A&gt;olve to 1 SYMBOLGEN: Macro variable P1YYMM1 resolves to 12103 SYMBOLGEN: Macro variable PNME resolves to SALES SYMBOLGEN&lt;A href="https://www.playboimerch.com/sweatshirt" target="_self"&gt;:&lt;/A&gt; &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolves to 1 SYMBOLGEN: Macro variable TST resolves to t WARNING: Apparent symbolic reference P1YYMM1T not resolved. ==&amp;gt;&amp;gt; 1 202103 12103 SALES&amp;amp;P&lt;A href="https://www.playboimerch.com/hoodies/" target="_self"&gt;1&lt;/A&gt;YYMM1t..log and if I don't assign anything to the macro variable test it works fine. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN:&lt;/P&gt;
&lt;P&gt;The macro variable I resolve to 1 SYMBOLGEN: Macro variable MNTH1 resolves to 202103 SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN&lt;A href="https://www.playboimerch.com/vlone-x-playboi-carti" target="_self"&gt;:&lt;/A&gt; Macro variable P1YYMM1 resolves to 12103 SYMBOLGEN: Macro variable PNME resolves to SALES SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;. SYMBOLGEN: Macro variable I resolve to 1 SYMBOLGEN: Macro variable TST resolves to SYMBOLGEN: Macro variable P1YYMM1 resolves to 12103 i&lt;A href="https://www.playboimerch.com/" target="_self"&gt;=&lt;/A&gt;=&amp;gt;&amp;gt; 1 202103 12103 SALES12103.log&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 08:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813363#M505</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-15T08:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to resolve a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813366#M506</link>
      <description>&lt;P&gt;After seeing this post on the exact same problem named macro&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-a-Macro-variable/m-p/813307" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/how-do-i-resolve-a-Macro-variable/m-p/813307&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you read that thread. Since you are not the poster of that thread (are you?) I won't merge this thread with that one which I normally would with basically identical posts..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read that other post carefully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 08:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813366#M506</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-15T08:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to resolve a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813377#M507</link>
      <description>&lt;P&gt;Please explain WHAT you are trying to do?&lt;/P&gt;
&lt;P&gt;Is the goal to create a file name of&amp;nbsp;SALES12103.log from the separated pieces SALES, 12103, and .log ?&lt;/P&gt;
&lt;P&gt;Then why not just DO that.&lt;/P&gt;
&lt;P&gt;So let's start by initializing your input macro variables,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DIRNME=c:\downloads;
%let PNME=SALES ;
%let P1YYMM1=12103;
%let I=1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now we can use them to generate a new macro variable with the name you want.&amp;nbsp; Let's call it LOGNAME.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let logname=&amp;amp;DirNme.\LOGS;
%let logname=&amp;amp;logname\&amp;amp;pnme;
%let logname=&amp;amp;logname.&amp;amp;&amp;amp;p1yymm&amp;amp;i;
%let logname=&amp;amp;logname..log;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;435  %put &amp;amp;=logname;
LOGNAME=c:\downloads\LOGS\SALES12103.log
&lt;/PRE&gt;
&lt;P&gt;Now just use that in your macro call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%StrLog
(PName=%str(&amp;amp;PName )
,PrinttoName = &amp;amp;logname 
,ClearLog=N
); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 May 2022 16:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Is-it-possible-to-resolve-a-macro-variable/m-p/813377#M507</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-15T16:24:36Z</dc:date>
    </item>
  </channel>
</rss>

