<?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 assign value to macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468597#M119711</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I assign a macro variable a value of a variable?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make 'macro_variable' contain the value of a non macro variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words, if a variable value is 'ABC123' then I want the macro_variable to contain 'ABC123'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So like:&lt;/P&gt;&lt;P&gt;%let macro_variable = the value stored within (variable);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I then want to be able to create new variables called:&lt;/P&gt;&lt;P&gt;case_&amp;amp;macro_variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which would resolve to&amp;nbsp;a variable called case_ABC123 which I can then in turn assign values to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jun 2018 05:27:32 GMT</pubDate>
    <dc:creator>markc</dc:creator>
    <dc:date>2018-06-08T05:27:32Z</dc:date>
    <item>
      <title>assign value to macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468597#M119711</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I assign a macro variable a value of a variable?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make 'macro_variable' contain the value of a non macro variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words, if a variable value is 'ABC123' then I want the macro_variable to contain 'ABC123'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So like:&lt;/P&gt;&lt;P&gt;%let macro_variable = the value stored within (variable);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I then want to be able to create new variables called:&lt;/P&gt;&lt;P&gt;case_&amp;amp;macro_variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which would resolve to&amp;nbsp;a variable called case_ABC123 which I can then in turn assign values to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 05:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468597#M119711</guid>
      <dc:creator>markc</dc:creator>
      <dc:date>2018-06-08T05:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: assign value to macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468599#M119712</link>
      <description>&lt;P&gt;Can you post example data of what you have and what you want as result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data-step you can use call symputx('macro_variable', value), but be aware that you will only get value of the last observation. And, if you want to use a value as variable name, you have to check whether that value (including the prefix "case_") is still a valid variable name.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 05:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468599#M119712</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-06-08T05:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: assign value to macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468600#M119713</link>
      <description>&lt;P&gt;Use function symput to assign a variable data into a macro variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;call symput('&amp;lt;macro_var_name' , &amp;lt;variable_name&amp;gt;);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there are also functions&amp;nbsp;&lt;STRONG&gt;symputx&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;symputn&lt;/STRONG&gt; wit similar sytax, to assign CHAR or NUM type variable.&lt;/P&gt;
&lt;P&gt;check documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 05:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468600#M119713</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-06-08T05:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: assign value to macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468643#M119738</link>
      <description>&lt;P&gt;I read&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;'s answer and thought "symputn, what the heck is that?"&amp;nbsp; After 5 minutes of googling, turns out it's only valid for SCL programs, not DATA step programs.&amp;nbsp; But it's a good reminder to me to keep rereading the documentation with each release.&amp;nbsp; It's always possible you'll discover something that's been there for years...&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 10:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468643#M119738</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-06-08T10:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: assign value to macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468764#M119787</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I read&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;'s answer and thought "symputn, what the heck is that?"&amp;nbsp; After 5 minutes of googling, turns out it's only valid for SCL programs, not DATA step programs.&amp;nbsp; But it's a good reminder to me to keep rereading the documentation with each release.&amp;nbsp; It's always possible you'll discover something that's been there for years...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or migrated from one area to another.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 15:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-value-to-macro/m-p/468764#M119787</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-08T15:59:13Z</dc:date>
    </item>
  </channel>
</rss>

