<?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 Global Variable not referenced in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436724#M108651</link>
    <description>&lt;P&gt;Here is my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET T_DATA = 'NBKUP' ;&lt;BR /&gt;%LET INDTE = '02/11/2017' ;&lt;BR /&gt;%LET INCLS = 'YES' ;&lt;/P&gt;&lt;P&gt;%PUT 'SAYANX :' &amp;amp;T_DATA &amp;amp;INDTE &amp;amp;INCLS ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;libname dwmdb oracle user = 'idsdba01' password = 'imag1ne' path = 'GQDWD_DEV'; /* DEV */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP1 as&lt;/P&gt;&lt;P&gt;(select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA = "&amp;amp;T_DATA"&lt;BR /&gt;and INPUT_DATE = "&amp;amp;INDTE"&lt;BR /&gt;and INCLUDE_STATUS = "&amp;amp;INCLS" ) ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP2 as&lt;/P&gt;&lt;P&gt;( select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA = 'NBKUP'&lt;BR /&gt;and INPUT_DATE = '02/11/2017'&lt;BR /&gt;and INCLUDE_STATUS = 'YES' ) ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SASLOG :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: SAS initialization used:&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;2 %LET T_DATA = 'NBKUP' ;&lt;BR /&gt;3 %LET INDTE = '02/11/2017' ;&lt;BR /&gt;4 %LET INCLS = 'YES' ;&lt;BR /&gt;5&lt;BR /&gt;6 %PUT 'SAYANX :' &amp;amp;T_DATA &amp;amp;INDTE &amp;amp;INCLS ;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;'SAYANX :' 'NBKUP' '02/11/2017' 'YES'&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;7&lt;BR /&gt;8&lt;BR /&gt;9&lt;BR /&gt;10&lt;BR /&gt;11 libname dwmdb oracle user = 'idsdba01' password = XXXXXXXXX path = 'GQDWD_DEV';&lt;BR /&gt;NOTE: Libref DWMDB was successfully assigned as follows:&lt;BR /&gt;Engine: ORACLE&lt;BR /&gt;Physical Name: GQDWD_DEV&lt;BR /&gt;11 ! /* DEV */&lt;BR /&gt;12&lt;BR /&gt;13&lt;BR /&gt;14&lt;BR /&gt;15 proc sql;&lt;BR /&gt;16 CREATE TABLE BACKUP1 as&lt;BR /&gt;17&lt;BR /&gt;18 (select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;19 where TYPE_OF_DATA = "&amp;amp;T_DATA"&lt;BR /&gt;&amp;#12;2 The SAS System 09:45 Tuesday, February 13, 2018&lt;/P&gt;&lt;P&gt;20 and INPUT_DATE = "&amp;amp;INDTE"&lt;BR /&gt;21 and INCLUDE_STATUS = "&amp;amp;INCLS" ) ;&lt;BR /&gt;NOTE: &lt;U&gt;&lt;STRONG&gt;Table WORK.BACKUP1 created, with 0 rows and 35 columns&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;22 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.98 seconds&lt;BR /&gt;cpu time 0.05 seconds&lt;/P&gt;&lt;P&gt;23&lt;BR /&gt;24&lt;BR /&gt;25&lt;BR /&gt;26 proc sql;&lt;BR /&gt;27 CREATE TABLE BACKUP2 as&lt;BR /&gt;28&lt;BR /&gt;29 ( select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;30 where TYPE_OF_DATA = 'NBKUP'&lt;BR /&gt;31 and INPUT_DATE = '02/11/2017'&lt;BR /&gt;32 and INCLUDE_STATUS = 'YES' ) ;&lt;BR /&gt;NOTE: &lt;STRONG&gt;Table WORK.BACKUP2 created, with 42077 rows and 35 columns.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;33 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 6.92 seconds&lt;BR /&gt;cpu time 0.81 seconds&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414&lt;BR /&gt;NOTE: The SAS System used:&lt;BR /&gt;real time 8.30 seconds&lt;BR /&gt;cpu time 0.92 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know why the first query is not fetching any records, and the second query being same(hard-coded) fetches records&amp;nbsp;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 14:47:13 GMT</pubDate>
    <dc:creator>sayanapex06</dc:creator>
    <dc:date>2018-02-13T14:47:13Z</dc:date>
    <item>
      <title>Global Variable not referenced</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436724#M108651</link>
      <description>&lt;P&gt;Here is my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET T_DATA = 'NBKUP' ;&lt;BR /&gt;%LET INDTE = '02/11/2017' ;&lt;BR /&gt;%LET INCLS = 'YES' ;&lt;/P&gt;&lt;P&gt;%PUT 'SAYANX :' &amp;amp;T_DATA &amp;amp;INDTE &amp;amp;INCLS ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;libname dwmdb oracle user = 'idsdba01' password = 'imag1ne' path = 'GQDWD_DEV'; /* DEV */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP1 as&lt;/P&gt;&lt;P&gt;(select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA = "&amp;amp;T_DATA"&lt;BR /&gt;and INPUT_DATE = "&amp;amp;INDTE"&lt;BR /&gt;and INCLUDE_STATUS = "&amp;amp;INCLS" ) ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP2 as&lt;/P&gt;&lt;P&gt;( select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA = 'NBKUP'&lt;BR /&gt;and INPUT_DATE = '02/11/2017'&lt;BR /&gt;and INCLUDE_STATUS = 'YES' ) ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SASLOG :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: SAS initialization used:&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;2 %LET T_DATA = 'NBKUP' ;&lt;BR /&gt;3 %LET INDTE = '02/11/2017' ;&lt;BR /&gt;4 %LET INCLS = 'YES' ;&lt;BR /&gt;5&lt;BR /&gt;6 %PUT 'SAYANX :' &amp;amp;T_DATA &amp;amp;INDTE &amp;amp;INCLS ;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;'SAYANX :' 'NBKUP' '02/11/2017' 'YES'&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;7&lt;BR /&gt;8&lt;BR /&gt;9&lt;BR /&gt;10&lt;BR /&gt;11 libname dwmdb oracle user = 'idsdba01' password = XXXXXXXXX path = 'GQDWD_DEV';&lt;BR /&gt;NOTE: Libref DWMDB was successfully assigned as follows:&lt;BR /&gt;Engine: ORACLE&lt;BR /&gt;Physical Name: GQDWD_DEV&lt;BR /&gt;11 ! /* DEV */&lt;BR /&gt;12&lt;BR /&gt;13&lt;BR /&gt;14&lt;BR /&gt;15 proc sql;&lt;BR /&gt;16 CREATE TABLE BACKUP1 as&lt;BR /&gt;17&lt;BR /&gt;18 (select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;19 where TYPE_OF_DATA = "&amp;amp;T_DATA"&lt;BR /&gt;&amp;#12;2 The SAS System 09:45 Tuesday, February 13, 2018&lt;/P&gt;&lt;P&gt;20 and INPUT_DATE = "&amp;amp;INDTE"&lt;BR /&gt;21 and INCLUDE_STATUS = "&amp;amp;INCLS" ) ;&lt;BR /&gt;NOTE: &lt;U&gt;&lt;STRONG&gt;Table WORK.BACKUP1 created, with 0 rows and 35 columns&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;22 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.98 seconds&lt;BR /&gt;cpu time 0.05 seconds&lt;/P&gt;&lt;P&gt;23&lt;BR /&gt;24&lt;BR /&gt;25&lt;BR /&gt;26 proc sql;&lt;BR /&gt;27 CREATE TABLE BACKUP2 as&lt;BR /&gt;28&lt;BR /&gt;29 ( select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;30 where TYPE_OF_DATA = 'NBKUP'&lt;BR /&gt;31 and INPUT_DATE = '02/11/2017'&lt;BR /&gt;32 and INCLUDE_STATUS = 'YES' ) ;&lt;BR /&gt;NOTE: &lt;STRONG&gt;Table WORK.BACKUP2 created, with 42077 rows and 35 columns.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;33 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 6.92 seconds&lt;BR /&gt;cpu time 0.81 seconds&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414&lt;BR /&gt;NOTE: The SAS System used:&lt;BR /&gt;real time 8.30 seconds&lt;BR /&gt;cpu time 0.92 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know why the first query is not fetching any records, and the second query being same(hard-coded) fetches records&amp;nbsp;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 14:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436724#M108651</guid>
      <dc:creator>sayanapex06</dc:creator>
      <dc:date>2018-02-13T14:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable not referenced</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436728#M108654</link>
      <description>&lt;P&gt;Your %LET statements are assigning the wrong values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There should not be any quotes to the right of the equal sign in these %LET statements.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 14:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436728#M108654</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-13T14:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable not referenced</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436736#M108659</link>
      <description>&lt;P&gt;With&lt;/P&gt;
&lt;P&gt;LET T_DATA = 'NBKUP' ;&lt;/P&gt;
&lt;P&gt;use&lt;/P&gt;
&lt;P&gt;where TYPE_OF_DATA = &amp;amp;T_DATA&lt;/P&gt;
&lt;P&gt;otherwise&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where TYPE_OF_DATA = "&amp;amp;T_DATA"&lt;/P&gt;
&lt;P&gt;generates code that looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where TYPE_OF_DATA = " 'NBKUP' "&amp;nbsp;&amp;nbsp; so unless your data set variable contains the single quotes you don't want that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably better is not to include the single quotes in the macro variable value.&lt;/P&gt;
&lt;P&gt;LET T_DATA = NBKUP ;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;where TYPE_OF_DATA = "&amp;amp;T_DATA."&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436736#M108659</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-13T15:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable not referenced</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436760#M108668</link>
      <description>&lt;P&gt;Your syntax needs to be valid, so lets see what it resolves to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP1 as&lt;/P&gt;
&lt;P&gt;(select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA =&lt;FONT color="#800080"&gt;&lt;STRONG&gt; "&amp;amp;T_DATA"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;and INPUT_DATE = "&lt;FONT color="#800080"&gt;&lt;STRONG&gt;&amp;amp;INDTE&lt;/STRONG&gt;&lt;/FONT&gt;"&lt;BR /&gt;and INCLUDE_STATUS = &lt;FONT color="#800080"&gt;&lt;STRONG&gt;"&amp;amp;INCLS"&lt;/STRONG&gt;&lt;/FONT&gt; ) ;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BECOMES&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE BACKUP1 as&lt;/P&gt;
&lt;P&gt;(select * from dwmdb.t_compute_tx_tbl&lt;BR /&gt;where TYPE_OF_DATA = &lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"'NBKUP'"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;and INPUT_DATE =&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt; "'02/11/2017'&amp;nbsp;"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;and INCLUDE_STATUS = &lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"'YES'"&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;) ;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the mistakes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. single and double quotes - that won't resolve the way you want it to&lt;/P&gt;
&lt;P&gt;2. Date as character - if your date is a SAS date this is specified incorrectly.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Global-Variable-not-referenced/m-p/436760#M108668</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-13T15:50:18Z</dc:date>
    </item>
  </channel>
</rss>

