<?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: Resolve a series of macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472983#M121322</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203676"&gt;@liyongkai800&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The reason is that I calculate those macro variables in the earlier step and want to use them in later data step. My real program is like&lt;BR /&gt;data want;&lt;BR /&gt;set one;&lt;BR /&gt;Impose the do loop on set one(include that series of macro variables)&lt;BR /&gt;That might be bizarre for you, but as a fresh sas man, I can't come up with a better idea.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Anytime you have a &lt;EM&gt;series&lt;/EM&gt; of data, consider to store it in a dataset. If you need it for look-up purposes, create a format from that dataset.&lt;/P&gt;
&lt;P&gt;I basically only store singular pieces of data (like a cutoff date, or a company descriptor for filtering) in macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Think like that: the macro preprocessor helps you in making &lt;EM&gt;code&lt;/EM&gt; dynamic. It is not designed (or meant) for handling &lt;EM&gt;data&lt;/EM&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 13:31:12 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-06-25T13:31:12Z</dc:date>
    <item>
      <title>Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472964#M121313</link>
      <description>&lt;P&gt;Hello, I want to resolve a series of macro variables in a do loop, but the following program doesn't work. For some reason, I can't&lt;/P&gt;&lt;P&gt;define the array for mac1-mac3. Any idea on how to resolve them directly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let mac1=2;&lt;BR /&gt;%let mac2=3;&lt;BR /&gt;%let mac3=7;&lt;BR /&gt;data test;&lt;BR /&gt;array gg{3} gg1-gg3 ;&lt;BR /&gt;do i=1 to 3;&lt;BR /&gt;gg{i}=dequote(cats('&amp;amp;','mac',put(i,best.)));&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 12:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472964#M121313</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-06-25T12:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472966#M121314</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mac1=2;
%let mac2=3;
%let mac3=7;
data test;
array gg{3} gg1-gg3 ;
do i=1 to 3;
gg{i}=symgetn(cats('mac',i));
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472966#M121314</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-25T13:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472972#M121316</link>
      <description>I appreciate your help, Ksharp. This is the second time you help me in time. Thanks so much.</description>
      <pubDate>Mon, 25 Jun 2018 13:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472972#M121316</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-06-25T13:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472977#M121319</link>
      <description>&lt;P&gt;Why would you put numerical data into character macro variables, then write a datastep to put them into a series of numerical variables in a dataset using&amp;nbsp;implicit conversion?&amp;nbsp; The whole process seems bizarre?&lt;/P&gt;
&lt;PRE&gt;data test;
  gg1=1;
  gg2=2;
  gg3=3;
run;&lt;/PRE&gt;
&lt;P&gt;This is effectively what the code does?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472977#M121319</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-25T13:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472982#M121321</link>
      <description>The reason is that I calculate those macro variables in the earlier step and want to use them in later data step. My real program is like&lt;BR /&gt;data want;&lt;BR /&gt;set one;&lt;BR /&gt;Impose the do loop on set one(include that series of macro variables)&lt;BR /&gt;That might be bizarre for you, but as a fresh sas man, I can't come up with a better idea.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472982#M121321</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-06-25T13:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472983#M121322</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203676"&gt;@liyongkai800&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The reason is that I calculate those macro variables in the earlier step and want to use them in later data step. My real program is like&lt;BR /&gt;data want;&lt;BR /&gt;set one;&lt;BR /&gt;Impose the do loop on set one(include that series of macro variables)&lt;BR /&gt;That might be bizarre for you, but as a fresh sas man, I can't come up with a better idea.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Anytime you have a &lt;EM&gt;series&lt;/EM&gt; of data, consider to store it in a dataset. If you need it for look-up purposes, create a format from that dataset.&lt;/P&gt;
&lt;P&gt;I basically only store singular pieces of data (like a cutoff date, or a company descriptor for filtering) in macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Think like that: the macro preprocessor helps you in making &lt;EM&gt;code&lt;/EM&gt; dynamic. It is not designed (or meant) for handling &lt;EM&gt;data&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472983#M121322</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-25T13:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472986#M121324</link>
      <description>&lt;P&gt;Just to add to that, you also use the ability to merge/join data as well.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472986#M121324</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-25T13:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472987#M121325</link>
      <description>&lt;P&gt;So if you have single observation dataset with those three variables you can include into a future and there is no need to move the values into macro variables at all.&lt;/P&gt;
&lt;P&gt;Say you have the values in a dataset name SUMMARY and you want to combine that with another dataset named HAVE to produce a dataset named WANT.&amp;nbsp; You might code something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  if _n_=1 then set summary ;
  set have ;
  * Calculations using variables from HAVE and SUMMARY ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will automatically retain the values of the variables from SUMMARY onto all iterations of the data step.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/472987#M121325</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-25T13:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve a series of macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/473115#M121368</link>
      <description>Thanks, I will take that for later program.</description>
      <pubDate>Mon, 25 Jun 2018 18:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-a-series-of-macro-variables/m-p/473115#M121368</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-06-25T18:59:03Z</dc:date>
    </item>
  </channel>
</rss>

