<?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: Resolve Macro Variable At Execution within PROC SQL VIEW in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266195#M52430</link>
    <description>Thanks Quentin. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I agree.  I'll have to create a work-a-round with a macro.</description>
    <pubDate>Mon, 25 Apr 2016 20:16:15 GMT</pubDate>
    <dc:creator>SASMike</dc:creator>
    <dc:date>2016-04-25T20:16:15Z</dc:date>
    <item>
      <title>Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266170#M52424</link>
      <description>&lt;P&gt;Is it possible to resolve a macro variable within a PROC SQL view at execution time?&amp;nbsp; I have a query with a dynamic FROM reference and I'd like to create a view without the current value of that macro being stored with the definition of the view.&amp;nbsp; I've tried SYMGET() to no avail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my example.&amp;nbsp; I'd like to be able to change MYMACROVARIABLE from table1 to table2 without having to redefine the view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATE VIEW test AS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT *&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM &amp;amp;MYMACROVARIABLE;&lt;/P&gt;
&lt;P&gt;QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any feedback would be appreciated! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 19:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266170#M52424</guid>
      <dc:creator>SASMike</dc:creator>
      <dc:date>2016-04-25T19:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266188#M52427</link>
      <description>&lt;P&gt;I can't think of way of doing this from the top of my head.&lt;/P&gt;
&lt;P&gt;And that seems reasonable - since the view, like a table, must contain columns with data types, labels and formats. Can't see how that can work "out of the box" by allowing dynamic change of part of the SQL view code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But tell us a bit about your application/requirement, perhaps there another option to solve your problem.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 20:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266188#M52427</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-25T20:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266190#M52428</link>
      <description>&lt;P&gt;I wouldn't think so.&amp;nbsp;When that CREATE VIEW statement executes, I think&amp;nbsp;it needs to be a complete statement, including the FROM clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could of course generate the statement in a macro, something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro makeview(view,from=);
      CREATE VIEW &amp;amp;view AS
             SELECT *
             FROM &amp;amp;from
      ;
%mend ;

%let myMacroVariable=sashelp.class;

PROC SQL;
      %MakeView(Vclass,from=&amp;amp;MyMacroVariable)
      %MakeView(Vshoes,from=sashelp.shoes)
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Apr 2016 20:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266190#M52428</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-04-25T20:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266195#M52430</link>
      <description>Thanks Quentin. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I agree.  I'll have to create a work-a-round with a macro.</description>
      <pubDate>Mon, 25 Apr 2016 20:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266195#M52430</guid>
      <dc:creator>SASMike</dc:creator>
      <dc:date>2016-04-25T20:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266292#M52462</link>
      <description>&lt;P&gt;This will probably&amp;nbsp;work just fine in a single user environment. But if it is, why the need to create a view in this dynamic fashion.&lt;/P&gt;
&lt;P&gt;In a multi user/application&amp;nbsp;environment, you probably need some other mechanism to make data available&amp;nbsp;- creating permanent views can be a really mess without&amp;nbsp;proper maintenance/architecture.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 06:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266292#M52462</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-26T06:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro Variable At Execution within PROC SQL VIEW</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266305#M52467</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you give a scenario where you would need to create a view on a table you don't yet know? &amp;nbsp;Seems a bit counterintuitive. &amp;nbsp;A view is a picture of the data, so if you don't know the data, why or how would you be able to create a picture of it?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 07:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-Variable-At-Execution-within-PROC-SQL-VIEW/m-p/266305#M52467</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-26T07:51:08Z</dc:date>
    </item>
  </channel>
</rss>

