<?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: How do I set the value of column equal to macro variable contents in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500532#M364</link>
    <description>&lt;P&gt;That fixed it, thanks.&amp;nbsp; The problem seemed to be that I wasn't declaring the value first.&amp;nbsp; Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Oct 2018 19:46:19 GMT</pubDate>
    <dc:creator>boyandhisrobot</dc:creator>
    <dc:date>2018-10-01T19:46:19Z</dc:date>
    <item>
      <title>How do I set the value of column equal to macro variable contents</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500523#M360</link>
      <description>&lt;P&gt;Hi, All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a macro variable (%let id = T1234;) and I would like the value of a variable to be equal to this macro variable.&amp;nbsp; It should like like so:&lt;/P&gt;&lt;P&gt;col1 col2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;T1234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;T1234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried the following:&amp;nbsp;&amp;nbsp;proc sql; select col1, "&amp;amp;id." as col2 from some_table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this doesn't work.&amp;nbsp; I end up with:&lt;/P&gt;&lt;P&gt;col1 col2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp;id.&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp;id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also tried using a data step (col2&amp;nbsp;= '"&amp;amp;id.";).&amp;nbsp; This doesn't work either - only the first character will print (I assume because the second character may be numeric?).&amp;nbsp; The results look something like this:&lt;/P&gt;&lt;P&gt;col1 col2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; T&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice or help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 19:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500523#M360</guid>
      <dc:creator>boyandhisrobot</dc:creator>
      <dc:date>2018-10-01T19:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set the value of column equal to macro variable contents</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500524#M361</link>
      <description>&lt;P&gt;Not sure what's the problem, here is my test&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let id=T1234;

data want;
do col1=1,2;
col2="&amp;amp;id";
output;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Oct 2018 19:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500524#M361</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-01T19:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set the value of column equal to macro variable contents</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500526#M362</link>
      <description>&lt;P&gt;This should work, just make sure you declare the macro variable before you create the table AND that it's in double quotes not single quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc sql; 
select col1, "&amp;amp;id." as col2 
from some_table; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Oct 2018 19:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500526#M362</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-01T19:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set the value of column equal to macro variable contents</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500532#M364</link>
      <description>&lt;P&gt;That fixed it, thanks.&amp;nbsp; The problem seemed to be that I wasn't declaring the value first.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 19:46:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-set-the-value-of-column-equal-to-macro-variable/m-p/500532#M364</guid>
      <dc:creator>boyandhisrobot</dc:creator>
      <dc:date>2018-10-01T19:46:19Z</dc:date>
    </item>
  </channel>
</rss>

