<?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 multiple macro vars from data set 2 columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776049#M246733</link>
    <description>&lt;P&gt;Use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1fa0ay5pzr9yun1mvqxv8ipzd4d.htm" target="_self"&gt;CALL SYMPUTX Routine&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Sat, 23 Oct 2021 18:58:39 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-10-23T18:58:39Z</dc:date>
    <item>
      <title>create multiple macro vars from data set 2 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776047#M246731</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to create multiple macro variables based on the data set macro_var_help.&lt;/P&gt;
&lt;P&gt;In the data set 2 columns(First columns is values ,Second column is macro var name)&lt;/P&gt;
&lt;P&gt;The following macro variables should be created:&lt;/P&gt;
&lt;P&gt;Today(value 1903)&lt;/P&gt;
&lt;P&gt;NextQ(value 1906)&lt;/P&gt;
&lt;P&gt;Q3(value 1912)&lt;/P&gt;
&lt;P&gt;Jan21(value 2101)&lt;/P&gt;
&lt;P&gt;Apr21(value2104)&lt;/P&gt;
&lt;P&gt;last(value2108),&lt;/P&gt;
&lt;P&gt;What is the way to do it based on the data set values?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data macro_var_help;
input YYMM name $;
cards;
1903 Today
1906 NextQ
1912 Q3
2101 Jan21
2104 Apr21
2108 last
;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Oct 2021 18:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776047#M246731</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-10-23T18:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: create multiple macro vars from data set 2 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776048#M246732</link>
      <description>&lt;P&gt;CALL SYMPUTX(), look at &amp;nbsp;the third parameter option in the documentation to control if it's a global or local macro variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set macro_var_help;

call symputx(name, YYMM);

run;

%put &amp;amp;today.;
%put &amp;amp;Jan21.;
%put &amp;amp;Q3.;
%put &amp;amp;last.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to create multiple macro variables based on the data set macro_var_help.&lt;/P&gt;
&lt;P&gt;In the data set 2 columns(First columns is values ,Second column is macro var name)&lt;/P&gt;
&lt;P&gt;The following macro variables should be created:&lt;/P&gt;
&lt;P&gt;Today(value 1903)&lt;/P&gt;
&lt;P&gt;NextQ(value 1906)&lt;/P&gt;
&lt;P&gt;Q3(value 1912)&lt;/P&gt;
&lt;P&gt;Jan21(value 2101)&lt;/P&gt;
&lt;P&gt;Apr21(value2104)&lt;/P&gt;
&lt;P&gt;last(value2108),&lt;/P&gt;
&lt;P&gt;What is the way to do it based on the data set values?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data macro_var_help;
input YYMM name $;
cards;
1903 Today
1906 NextQ
1912 Q3
2101 Jan21
2104 Apr21
2108 last
;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Oct 2021 18:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776048#M246732</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-23T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: create multiple macro vars from data set 2 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776049#M246733</link>
      <description>&lt;P&gt;Use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1fa0ay5pzr9yun1mvqxv8ipzd4d.htm" target="_self"&gt;CALL SYMPUTX Routine&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Oct 2021 18:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-multiple-macro-vars-from-data-set-2-columns/m-p/776049#M246733</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-10-23T18:58:39Z</dc:date>
    </item>
  </channel>
</rss>

