<?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 resolving in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544089#M150445</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203676"&gt;@liyongkai800&lt;/a&gt;&amp;nbsp; &amp;nbsp;Adding on to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; clearly explained, I am wondering do you really want many datasteps or the code should be&lt;/P&gt;
&lt;P&gt;/*see the commented part*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

%let var1=left;

%let var2=center;

%let var3=right;

 
%put &amp;amp;var1;
/*options symbolgen;*/
%macro example;
data whatever;
%do i=1 %to 3;

%do j=1 %to 2;

%global list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j;

/*data whatever;*/

list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j=1;

/*run;*/

%end;

%end;
run;
%mend;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%example;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Mar 2019 19:14:57 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-03-18T19:14:57Z</dc:date>
    <item>
      <title>macro resolving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544083#M150443</link>
      <description>&lt;P&gt;Here is my question. I want to create several variables to store the values, where the suffix is an index, and strings are changed based on different conditions. However, the following code doesn't generate the expected output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let var1=left;&lt;/P&gt;&lt;P&gt;%let var2=center;&lt;/P&gt;&lt;P&gt;%let var3=right;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro example;&lt;/P&gt;&lt;P&gt;%do i=1 %to 3;&lt;/P&gt;&lt;P&gt;%do j=1 %to 2;&lt;/P&gt;&lt;P&gt;%global list_&amp;amp;&amp;amp;var&amp;amp;i_&amp;amp;j;&lt;/P&gt;&lt;P&gt;data whatever;&lt;/P&gt;&lt;P&gt;list_&amp;amp;&amp;amp;var&amp;amp;i_&amp;amp;j=1&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%example;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the macros resolved separately to have&amp;nbsp;list_left_1, list_left_2,list_center_1,list_center_2,list_right_1,list_right_2. How can I get them? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 19:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544083#M150443</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2019-03-18T19:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: macro resolving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544088#M150444</link>
      <description>&lt;P&gt;You need a dot to separate the macro variable name from the following text. In this case because you have a double ampersand, you need a double dot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%global list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same thing here, and you left out a semi-colon as well&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data whatever;
    list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2019 19:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544088#M150444</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-18T19:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: macro resolving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544089#M150445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203676"&gt;@liyongkai800&lt;/a&gt;&amp;nbsp; &amp;nbsp;Adding on to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; clearly explained, I am wondering do you really want many datasteps or the code should be&lt;/P&gt;
&lt;P&gt;/*see the commented part*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

%let var1=left;

%let var2=center;

%let var3=right;

 
%put &amp;amp;var1;
/*options symbolgen;*/
%macro example;
data whatever;
%do i=1 %to 3;

%do j=1 %to 2;

%global list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j;

/*data whatever;*/

list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j=1;

/*run;*/

%end;

%end;
run;
%mend;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%example;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2019 19:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544089#M150445</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-18T19:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: macro resolving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544091#M150447</link>
      <description>Thanks for your comments. Originally, I want to create some lists to store some vectors. But I totally agree with you if I want to store everything in a data set.</description>
      <pubDate>Mon, 18 Mar 2019 19:19:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544091#M150447</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2019-03-18T19:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: macro resolving</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544122#M150466</link>
      <description>&lt;P&gt;If you are looking to add multiple variables to the data set as a single row:&lt;/P&gt;
&lt;PRE&gt;%macro example;
   data whatever;
   %do i=1 %to 3;
      %do j=1 %to 2;
         list_&amp;amp;&amp;amp;var&amp;amp;i.._&amp;amp;j=1 ;
      %end;
   %end;
   run;

%mend;&lt;/PRE&gt;
&lt;P&gt;It really helps to show what the desired data set should actually look like.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 22:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-resolving/m-p/544122#M150466</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-18T22:57:07Z</dc:date>
    </item>
  </channel>
</rss>

