<?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: Help with proc sql variable equal in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339686#M77524</link>
    <description>&lt;P&gt;Good catch, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;!&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2017 15:56:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-03-09T15:56:03Z</dc:date>
    <item>
      <title>Help with proc sql variable equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339595#M77499</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to output a status code that was on an account at the same time a specific note code (SQ) was placed.&amp;nbsp; Here is the code I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
    create table Putback_Report as

SELECT
  ACCT_DIM.ACCT_NUM,
  ACTVT_RSLT_FACT.TRN_DT as REQ_DT,
  ACTVT_RSLT_FACT.TRN_CD as REQ_CD,
  &lt;STRONG&gt;ACCT_STATUS_HIST.STATUS_CD,&lt;/STRONG&gt;
  ACCT_DIM.ATTORNEY_CD,
  ATTORNEY_CD_LOOKUP.RECOVERER_CD_DESC

FROM
  RDWP0.ACCT_DIM,
  RDWP0.RECOVERER_CD_LOOKUP ATTORNEY_CD_LOOKUP,
  RDWP0.ACTVT_RSLT_FACT,
  RDWP0.ACCT_STATUS_HIST

WHERE
        ( ACCT_DIM.ACCT_ID=ACTVT_RSLT_FACT.ACCT_ID )
  AND   (ATTORNEY_CD_LOOKUP.RECOVERER_CD=ACCT_DIM.ATTORNEY_CD)
  AND   ACTVT_RSLT_FACT.TRN_CD = 'SQ'
&lt;STRONG&gt;  AND   (ACCT_STATUS_HIST.STATUS_START_DT = ACTVT_RSLT_FACT.TRN_DT)
  AND   (ACCT_STATUS_HIST.STATUS_END_DT = ACTVT_RSLT_FACT.TRN_DT)&lt;/STRONG&gt;
  AND   ACTVT_RSLT_FACT.TRN_DT BETWEEN '07JAN2017'd and '07JAN2017'd&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The account status&amp;nbsp;history table contains values for all status code history&amp;nbsp;on an account and I need it to match with SQ. I've tried placing (the bold text) after the TRN_Dt, added parenthesis, added&amp;nbsp;&amp;gt;= and &amp;lt;= (SAS stated couldn't recognize &amp;lt;&amp;gt;'s). All I want to do is give me the status code as of Jan 7, 2017.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;output&lt;/STRONG&gt; I am getting appears to be a status code (A23)&amp;nbsp;but cannot find it on the account history.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ACCT_NUM	REQ_DT	             REQ_CD	STATUS_CD
0000000000000000 07Jan2017 0:00:00	SQ	A23&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone confirm my syntax is correct?&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>Thu, 09 Mar 2017 12:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339595#M77499</guid>
      <dc:creator>jmoore168</dc:creator>
      <dc:date>2017-03-09T12:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with proc sql variable equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339598#M77500</link>
      <description>&lt;P&gt;First thing I'd do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select * from RDWP0.ACCT_STATUS_HIST
where STATUS_CD = 'A23'
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Data doesn't appear out of nowhere.&lt;/P&gt;
&lt;P&gt;Please post the log of your SQL; maybe there's a message there that you didn't recognize as important.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ACTVT_RSLT_FACT.TRN_DT BETWEEN '07JAN2017'd and '07JAN2017'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is equal to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ACTVT_RSLT_FACT.TRN_DT = '07JAN2017'd&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2017 12:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339598#M77500</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-09T12:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with proc sql variable equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339684#M77523</link>
      <description>&lt;P&gt;Actually, I'm surprised that you're getting any records selected as your condition:&lt;/P&gt;
&lt;PRE&gt;ACTVT_RSLT_FACT.TRN_DT BETWEEN '07JAN2017'd and '07JAN2017'd&lt;/PRE&gt;
&lt;P&gt;appears to be comparing a datetime variable with a date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 15:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339684#M77523</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-09T15:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with proc sql variable equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339686#M77524</link>
      <description>&lt;P&gt;Good catch, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 15:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-proc-sql-variable-equal/m-p/339686#M77524</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-09T15:56:03Z</dc:date>
    </item>
  </channel>
</rss>

