<?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 in my pgm to resolve macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm-to-resolve-macro-variables/m-p/503313#M134467</link>
    <description>&lt;P&gt;Once again, misunderstanding of macro timing.&lt;/P&gt;
&lt;P&gt;The put statements are part of data step code, and so the macro &lt;EM&gt;&lt;STRONG&gt;PRE&lt;/STRONG&gt;&lt;/EM&gt;processor tries to resolve the macro variables before they are created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use %put &lt;EM&gt;after&lt;/EM&gt; the data step boundary (the run statement):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let gmvar_asat           = %str((Population)) ;
%let gmvar_subtitle       = %str(Population| Phases(adjuvant and Adjuvant Phases));
%let title_1=%str(Between-Treatment Comparisons in Adverse Events);
%let subtitle=&amp;amp;gmvar_subtitle.|&amp;amp;gmvar_asat.;

data _null_;
    length  item $1000;
     
    %* Create Macro variables Title1-Title# to hold the title and subtitle rows *;
    title_number = 0;
    item = "&amp;amp;title_1." ; 

    title_number=title_number + 1;
    call symput("title" || compress(put(title_number,8.)), compbl(item) );

    temp_subtitle=trim(left("%nrbquote(&amp;amp;subtitle)"));
    _sindex = 1 ;

 
    do while(lengthn(scan(temp_subtitle,_sindex,"|")) &amp;gt; 0);
        title_number=title_number + 1;
        item=trim(left(scan(temp_subtitle,_sindex,"|")));
        call symput("title" || compress(put(title_number,8.)), trim(left(item)) );
        output;
        _sindex=_sindex+1;
    end;
run;

%put title1=&amp;amp;title1.;
%put title2=&amp;amp;title2.;
%put title3=&amp;amp;title3.;
%put title4=&amp;amp;title4.;
	&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Oct 2018 06:21:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-11T06:21:33Z</dc:date>
    <item>
      <title>Help in my pgm to resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm-to-resolve-macro-variables/m-p/503302#M134465</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;In my pgm why the the &amp;amp;title1-&amp;amp;title4 are not resolved. I am getting errors when i ran below data _null_ step. Please help. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let gmvar_asat           = %str((Population)) ;
%let gmvar_subtitle       = %str(Population| Phases(adjuvant and Adjuvant Phases));
%let title_1=%str(Between-Treatment Comparisons in Adverse Events);
%let subtitle=&amp;amp;gmvar_subtitle.|&amp;amp;gmvar_asat.;



data _null_;
    length  item $1000;
     
    %* Create Macro variables Title1-Title# to hold the title and subtitle rows *;
    title_number = 0;
    item = "&amp;amp;title_1." ; 

    title_number=title_number + 1;
    call symput("title" || compress(put(title_number,8.)), compbl(item) );

    temp_subtitle=trim(left("%nrbquote(&amp;amp;subtitle)"));
    _sindex = 1 ;

 
    do while(lengthn(scan(temp_subtitle,_sindex,"|")) &amp;gt; 0);
        title_number=title_number + 1;
        item=trim(left(scan(temp_subtitle,_sindex,"|")));
        call symput("title" || compress(put(title_number,8.)), trim(left(item)) );
        output;
        _sindex=_sindex+1;
    end;

  &lt;FONT color="#800000"&gt;  put &amp;amp;title1.=;
	put &amp;amp;title2.=;
	put &amp;amp;title3.=;
    put &amp;amp;title4.=;&lt;/FONT&gt;
	run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Oct 2018 04:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm-to-resolve-macro-variables/m-p/503302#M134465</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2018-10-11T04:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm to resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm-to-resolve-macro-variables/m-p/503313#M134467</link>
      <description>&lt;P&gt;Once again, misunderstanding of macro timing.&lt;/P&gt;
&lt;P&gt;The put statements are part of data step code, and so the macro &lt;EM&gt;&lt;STRONG&gt;PRE&lt;/STRONG&gt;&lt;/EM&gt;processor tries to resolve the macro variables before they are created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use %put &lt;EM&gt;after&lt;/EM&gt; the data step boundary (the run statement):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let gmvar_asat           = %str((Population)) ;
%let gmvar_subtitle       = %str(Population| Phases(adjuvant and Adjuvant Phases));
%let title_1=%str(Between-Treatment Comparisons in Adverse Events);
%let subtitle=&amp;amp;gmvar_subtitle.|&amp;amp;gmvar_asat.;

data _null_;
    length  item $1000;
     
    %* Create Macro variables Title1-Title# to hold the title and subtitle rows *;
    title_number = 0;
    item = "&amp;amp;title_1." ; 

    title_number=title_number + 1;
    call symput("title" || compress(put(title_number,8.)), compbl(item) );

    temp_subtitle=trim(left("%nrbquote(&amp;amp;subtitle)"));
    _sindex = 1 ;

 
    do while(lengthn(scan(temp_subtitle,_sindex,"|")) &amp;gt; 0);
        title_number=title_number + 1;
        item=trim(left(scan(temp_subtitle,_sindex,"|")));
        call symput("title" || compress(put(title_number,8.)), trim(left(item)) );
        output;
        _sindex=_sindex+1;
    end;
run;

%put title1=&amp;amp;title1.;
%put title2=&amp;amp;title2.;
%put title3=&amp;amp;title3.;
%put title4=&amp;amp;title4.;
	&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Oct 2018 06:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm-to-resolve-macro-variables/m-p/503313#M134467</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-11T06:21:33Z</dc:date>
    </item>
  </channel>
</rss>

