<?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: create vector macro var automatically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652533#M195922</link>
    <description>%let final_str=;&lt;BR /&gt;%do count=1 %to %eval(&amp;amp;n-1);&lt;BR /&gt;%let final_str=&amp;amp;final_str.%str(+)&amp;amp;&amp;amp;mon&amp;amp;count.;&lt;BR /&gt;%end;&lt;BR /&gt;%let final_str=&amp;amp;final_str.%str(+)&amp;amp;&amp;amp;mon&amp;amp;count.;</description>
    <pubDate>Tue, 02 Jun 2020 13:30:14 GMT</pubDate>
    <dc:creator>smantha</dc:creator>
    <dc:date>2020-06-02T13:30:14Z</dc:date>
    <item>
      <title>create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652474#M195889</link>
      <description>&lt;P&gt;&lt;EM&gt;Hello&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mon1=2020;
%let mon2=2016;
/*I want to create another macro variable called vector that will get value 2020+2016
instead of define it manually %let vector=2020+2016;
I want that it will be defined automatically */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 10:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652474#M195889</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-02T10:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652479#M195891</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let want = &amp;amp;mon1%str(+)&amp;amp;mon2;
%put &amp;amp;=want;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 11:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652479#M195891</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-02T11:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652529#M195919</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is another approach, using the CATX() function, and the plus operator as the delimiter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let vector= %sysfunc(catx(+,&amp;amp;mon1.,&amp;amp;mon2.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 13:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652529#M195919</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-02T13:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652533#M195922</link>
      <description>%let final_str=;&lt;BR /&gt;%do count=1 %to %eval(&amp;amp;n-1);&lt;BR /&gt;%let final_str=&amp;amp;final_str.%str(+)&amp;amp;&amp;amp;mon&amp;amp;count.;&lt;BR /&gt;%end;&lt;BR /&gt;%let final_str=&amp;amp;final_str.%str(+)&amp;amp;&amp;amp;mon&amp;amp;count.;</description>
      <pubDate>Tue, 02 Jun 2020 13:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652533#M195922</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-02T13:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652541#M195923</link>
      <description>&lt;P&gt;I am not sure I understand what your question means.&amp;nbsp; Is it as simple runnng a %LET statement?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mon1=2020;
%let mon2=2016;
%let vector=&amp;amp;mon1+&amp;amp;mon2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;530   %put &amp;amp;=vector;
VECTOR=2020+2016&lt;/PRE&gt;
&lt;P&gt;Or did you want to assign a value to VECTOR in a way that its value will change without having to re-create it?&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('vector','&amp;amp;mon1+&amp;amp;mon2');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;535   %put %superq(vector);
&amp;amp;mon1+&amp;amp;mon2
536   %put &amp;amp;=vector;
VECTOR=2020+2016
537   %let mon1=2030;
538   %put &amp;amp;=mon1 &amp;amp;=mon2 &amp;amp;=vector;
MON1=2030 MON2=2016 VECTOR=2030+2016&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 13:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652541#M195923</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-06-02T13:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: create vector macro var automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652552#M195928</link>
      <description>&lt;P&gt;Not quite sure what you want. Is it just one variable with the text you displayed? then just do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let vector=&amp;amp;mon1+&amp;amp;mon2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or do you want the calculated sum? then do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let vector=%eval(&amp;amp;mon1+&amp;amp;mon2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 14:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-vector-macro-var-automatically/m-p/652552#M195928</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-06-02T14:16:35Z</dc:date>
    </item>
  </channel>
</rss>

