<?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 SAS: Is it possible in SAS to assign values from one column to a macro variables from another column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658359#M197317</link>
    <description>&lt;DIV class="votecell post-layout--left"&gt;&lt;DIV class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200"&gt;&lt;DIV class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="postcell post-layout--right"&gt;&lt;DIV class="post-text"&gt;&lt;P&gt;Hy guys,&lt;/P&gt;&lt;P&gt;I have lost my head already finding the solution to my problem.&lt;/P&gt;&lt;P&gt;I have two columns &lt;STRONG&gt;VarName&lt;/STRONG&gt; and &lt;STRONG&gt;VarDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want to assign values of &lt;STRONG&gt;VarDate&lt;/STRONG&gt; to macro variables in column &lt;STRONG&gt;VarName&lt;/STRONG&gt; not naming them separately one by one.&lt;/P&gt;&lt;P&gt;Result should be 14 macro variables with assigned values.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;For example:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;A_10; It should return me value 14/06/2020&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;A_11; It should return me value 12/06/2020&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;G_11; It should return me value 31/12/2021&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VarName $ VarDate :ddmmyy10.;
format VarDate ddmmyy10.;
datalines;
A_10 14/06/2020
A_11 12/06/2020
B_10 30/06/2020
B_11 30/06/2020
C_10 31/05/2020
C_11 29/05/2020
D_10 30/04/2020
D_11 30/04/2020
E_10 31/03/2020
E_11 31/03/2020
F_10 29/02/2020
F_11 28/02/2020
G_10 31/12/2021
G_11 31/12/2021
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 14 Jun 2020 14:55:46 GMT</pubDate>
    <dc:creator>Rentum</dc:creator>
    <dc:date>2020-06-14T14:55:46Z</dc:date>
    <item>
      <title>SAS: Is it possible in SAS to assign values from one column to a macro variables from another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658359#M197317</link>
      <description>&lt;DIV class="votecell post-layout--left"&gt;&lt;DIV class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200"&gt;&lt;DIV class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="postcell post-layout--right"&gt;&lt;DIV class="post-text"&gt;&lt;P&gt;Hy guys,&lt;/P&gt;&lt;P&gt;I have lost my head already finding the solution to my problem.&lt;/P&gt;&lt;P&gt;I have two columns &lt;STRONG&gt;VarName&lt;/STRONG&gt; and &lt;STRONG&gt;VarDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want to assign values of &lt;STRONG&gt;VarDate&lt;/STRONG&gt; to macro variables in column &lt;STRONG&gt;VarName&lt;/STRONG&gt; not naming them separately one by one.&lt;/P&gt;&lt;P&gt;Result should be 14 macro variables with assigned values.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;For example:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;A_10; It should return me value 14/06/2020&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;A_11; It should return me value 12/06/2020&lt;/P&gt;&lt;P&gt;if I would write %put &amp;amp;G_11; It should return me value 31/12/2021&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VarName $ VarDate :ddmmyy10.;
format VarDate ddmmyy10.;
datalines;
A_10 14/06/2020
A_11 12/06/2020
B_10 30/06/2020
B_11 30/06/2020
C_10 31/05/2020
C_11 29/05/2020
D_10 30/04/2020
D_11 30/04/2020
E_10 31/03/2020
E_11 31/03/2020
F_10 29/02/2020
F_11 28/02/2020
G_10 31/12/2021
G_11 31/12/2021
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 14 Jun 2020 14:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658359#M197317</guid>
      <dc:creator>Rentum</dc:creator>
      <dc:date>2020-06-14T14:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Is it possible in SAS to assign values from one column to a macro variables from another co</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658362#M197318</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333680"&gt;@Rentum&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	set have;
	call symputx(VarName, put(VarDate,ddmmyy10.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: if you want to use those macrovariables in further calculations, you should better keep the unformatted valued (even if not 'human-readable'). However, if it is for display in titles for example, formatted values are fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 15:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658362#M197318</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-14T15:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Is it possible in SAS to assign values from one column to a macro variables from another co</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658715#M197379</link>
      <description>&lt;P&gt;OH MY GOD! it was so easy, and I had tried so many difficult things.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you a lot, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp;you are my hero!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NB: In next step I have a macro that formats those dates for further use and there I have another question about how to put the list of variables when recalling the macro, but this is off topic of this question, so I will go to look for answer in a forum. Hope I can find it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 08:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658715#M197379</guid>
      <dc:creator>Rentum</dc:creator>
      <dc:date>2020-06-15T08:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Is it possible in SAS to assign values from one column to a macro variables from another co</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658857#M197386</link>
      <description>Thank you so much &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333680"&gt;@Rentum&lt;/a&gt; !</description>
      <pubDate>Mon, 15 Jun 2020 09:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Is-it-possible-in-SAS-to-assign-values-from-one-column-to-a/m-p/658857#M197386</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-15T09:31:30Z</dc:date>
    </item>
  </channel>
</rss>

