<?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: Using macro variable to rename column in query builder in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-macro-variable-to-rename-column-in-query-builder/m-p/10767#M2633</link>
    <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Tried out what you've described. The code generated looks actually like:&lt;BR /&gt;
'"AGE_&amp;amp;YEAR"'n&lt;BR /&gt;
&lt;BR /&gt;
This 'n' means that the string is interpreted as literal. Seems that SAS R&amp;amp;D was quite thoughtful in allowing us to define all kind of variable names but didn't anticipate your use case.&lt;BR /&gt;
Haven't found any option like "treat variable names as literals" which could be unchecked so I believe the current version of EG's query builder doesn't allow you what you try to do.&lt;BR /&gt;
&lt;BR /&gt;
You could define the variable label this way though by passing the macro var without quotes: AGE_&amp;amp;YEAR&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Sun, 12 Jun 2011 00:55:14 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2011-06-12T00:55:14Z</dc:date>
    <item>
      <title>Using macro variable to rename column in query builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-macro-variable-to-rename-column-in-query-builder/m-p/10766#M2632</link>
      <description>Hi !&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to use a macro variable as part of a column name. The main problem is that the query builder encloses the column name in simple quotes, and therefore doesn't recognise the macro variable as such.&lt;BR /&gt;
&lt;BR /&gt;
Here is what I have :&lt;BR /&gt;
&lt;BR /&gt;
a macro variable defined by a user prompt (which can be used, I checked) : YEAR&lt;BR /&gt;
and a column name which should be : "AGE_&amp;amp;YEAR" =&amp;gt; AGE_2010, AGE_2011...&lt;BR /&gt;
&lt;BR /&gt;
If I try this, SAS writes the following code : AS '"AGE_&amp;amp;YEAR"'... Is there a way to remove those simple quotes ? Other than writing a program, I mean...&lt;BR /&gt;
&lt;BR /&gt;
Thanks !</description>
      <pubDate>Fri, 10 Jun 2011 12:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-macro-variable-to-rename-column-in-query-builder/m-p/10766#M2632</guid>
      <dc:creator>Ansileran</dc:creator>
      <dc:date>2011-06-10T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variable to rename column in query builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-macro-variable-to-rename-column-in-query-builder/m-p/10767#M2633</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Tried out what you've described. The code generated looks actually like:&lt;BR /&gt;
'"AGE_&amp;amp;YEAR"'n&lt;BR /&gt;
&lt;BR /&gt;
This 'n' means that the string is interpreted as literal. Seems that SAS R&amp;amp;D was quite thoughtful in allowing us to define all kind of variable names but didn't anticipate your use case.&lt;BR /&gt;
Haven't found any option like "treat variable names as literals" which could be unchecked so I believe the current version of EG's query builder doesn't allow you what you try to do.&lt;BR /&gt;
&lt;BR /&gt;
You could define the variable label this way though by passing the macro var without quotes: AGE_&amp;amp;YEAR&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Sun, 12 Jun 2011 00:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-macro-variable-to-rename-column-in-query-builder/m-p/10767#M2633</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-12T00:55:14Z</dc:date>
    </item>
  </channel>
</rss>

