<?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 SAS Macro variable passing with Quations for ODBC table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721354#M27781</link>
    <description>&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; count(*) &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; :cntr &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NVPLocal.NVP_DOD_Catch ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;cntr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;distinct&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; qrm_db,strategy,moddate &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; :Var1,:Var2,:Var3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NVPLocal.NVP_DOD_Catch ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;outobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;connect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; odbc (DSN=&amp;amp;DSN user=&amp;amp;user password=&amp;amp;pwds);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; temp &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; connection to odbc (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; [FASTControl]&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;[dbo]&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;[ALM_NVPData] &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; qrm_db=&amp;amp;Var1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;disconnect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; odbc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;getting error message&lt;/P&gt;&lt;P&gt;ERROR: CLI describe error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'Jan21'. : [Microsoft][SQL&lt;/P&gt;&lt;P&gt;Server Native Client 11.0][SQL Server]Statement(s) could not be prepared.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 18:26:46 GMT</pubDate>
    <dc:creator>Ashpak</dc:creator>
    <dc:date>2021-02-23T18:26:46Z</dc:date>
    <item>
      <title>SAS Macro variable passing with Quations for ODBC table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721354#M27781</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; count(*) &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; :cntr &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NVPLocal.NVP_DOD_Catch ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;cntr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;distinct&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; qrm_db,strategy,moddate &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; :Var1,:Var2,:Var3 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NVPLocal.NVP_DOD_Catch ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Var3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;outobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;connect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; odbc (DSN=&amp;amp;DSN user=&amp;amp;user password=&amp;amp;pwds);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; temp &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; connection to odbc (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; [FASTControl]&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;[dbo]&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;[ALM_NVPData] &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; qrm_db=&amp;amp;Var1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;disconnect&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; odbc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;getting error message&lt;/P&gt;&lt;P&gt;ERROR: CLI describe error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'Jan21'. : [Microsoft][SQL&lt;/P&gt;&lt;P&gt;Server Native Client 11.0][SQL Server]Statement(s) could not be prepared.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 18:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721354#M27781</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2021-02-23T18:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro variable passing with Quations for ODBC table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721355#M27782</link>
      <description>&lt;P&gt;First, write the code so that you can get it to work WITHOUT macro variables. Then, it should be relatively easy to get the code to work WITH macro variables. Show us that code that works without macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when you get ERRORs, show us the LOG, the entire log for these two PROC SQLs, with nothing chopped out, in the order that it appears in the log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 18:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721355#M27782</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-23T18:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro variable passing with Quations for ODBC table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721359#M27783</link>
      <description>&lt;P&gt;If sounds like there is no variable named Jan21.&amp;nbsp; Did you want use the value of VAR1 macro variable as a string literal?&lt;/P&gt;
&lt;P&gt;If so why not just add the quotes when generating the macro variable. So if you did this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select quote(trim(qrm_db),"'") into :Var1 from NVPLocal.NVP_DOD_Catch ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then VAR1 will contain 'Jan21' instead of just Jan21.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 18:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721359#M27783</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-23T18:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro variable passing with Quations for ODBC table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721361#M27784</link>
      <description>Thanks this got worked out.</description>
      <pubDate>Tue, 23 Feb 2021 18:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Macro-variable-passing-with-Quations-for-ODBC-table/m-p/721361#M27784</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2021-02-23T18:44:19Z</dc:date>
    </item>
  </channel>
</rss>

