<?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: DM Studio: Using a macro in an expression node in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/288556#M8218</link>
    <description>&lt;P&gt;Your expression code will look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;string macro1&lt;BR /&gt;macro1 = getvar("MyMacro")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where MyMacro was defined in a macros file. A few things to check:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Have you used a "saved connection" with your DSN? This will have an impact on how you refer to your DSN in your macro. Using saved connections will reduce the DSN to just a name where not using them will mean you likely need to include additional information in your macro to refer to the database. Look at the advanced property of a node with a database connection and notice the difference when you do and do not use a saved connection.&lt;/LI&gt;
&lt;LI&gt;Is a schema involved? In some nodes they are represented by a different property. Your DSN macro in your expression code may only be part of what you need to connect when you build the connection string for the dbconnect object.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2016 12:22:53 GMT</pubDate>
    <dc:creator>RonAgresta</dc:creator>
    <dc:date>2016-08-01T12:22:53Z</dc:date>
    <item>
      <title>DM Studio: Using a macro in an expression node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/284214#M8104</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to use a macro for a datasource name. I've defined it under Administration &amp;gt; Macro Files, and I can use it successfully with other nodes, such as a SQL Query node. In an Expression node, though, it doesn't work. I've tried the two ways the Expression Language Guide suggests:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) DSN = %%dsn_name%%&lt;/P&gt;
&lt;P&gt;2) DS&lt;SPAN&gt;N = "%%dsn_name%%" &amp;nbsp; // with quotes&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2) DSN = getvar("dsn_name")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# 1 does not validate&lt;/P&gt;
&lt;P&gt;# 2,3 validates, but results in the same error: "Data source name not found and no default driver specified..."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using DM Studio 2.6.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; mark&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 23:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/284214#M8104</guid>
      <dc:creator>mal</dc:creator>
      <dc:date>2016-07-13T23:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: DM Studio: Using a macro in an expression node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/288556#M8218</link>
      <description>&lt;P&gt;Your expression code will look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;string macro1&lt;BR /&gt;macro1 = getvar("MyMacro")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where MyMacro was defined in a macros file. A few things to check:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Have you used a "saved connection" with your DSN? This will have an impact on how you refer to your DSN in your macro. Using saved connections will reduce the DSN to just a name where not using them will mean you likely need to include additional information in your macro to refer to the database. Look at the advanced property of a node with a database connection and notice the difference when you do and do not use a saved connection.&lt;/LI&gt;
&lt;LI&gt;Is a schema involved? In some nodes they are represented by a different property. Your DSN macro in your expression code may only be part of what you need to connect when you build the connection string for the dbconnect object.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 12:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/288556#M8218</guid>
      <dc:creator>RonAgresta</dc:creator>
      <dc:date>2016-08-01T12:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: DM Studio: Using a macro in an expression node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/288609#M8220</link>
      <description>&lt;P&gt;Hi Ron,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much! &amp;nbsp;I will try this out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; - mark&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 14:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DM-Studio-Using-a-macro-in-an-expression-node/m-p/288609#M8220</guid>
      <dc:creator>mal</dc:creator>
      <dc:date>2016-08-01T14:43:58Z</dc:date>
    </item>
  </channel>
</rss>

