<?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: Unable to convert MS Access SQL query to SAS Code in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518618#M3594</link>
    <description>I think the issue should be more so, which one is correct. It sounds like you have a possible order of operations type issue.</description>
    <pubDate>Wed, 05 Dec 2018 00:40:13 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-12-05T00:40:13Z</dc:date>
    <item>
      <title>Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518189#M3499</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;G'day!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to convert MS Access SQL Query code someone left in&amp;nbsp;to SAS Code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code in MS Access:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; TABLE1.STATUS AS IntStatus, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;170&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;170&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"NOT_UTD"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)))) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AS FinStatus_D&lt;/P&gt;
&lt;P&gt;FROM TABLE1 INNER JOIN TABLE5 TABLE1.ID = TABLE5.ID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;______________________________________________&lt;/P&gt;
&lt;P&gt;I've pasted my unsuccessful SAS code (not getting errors in log.&amp;nbsp;Just not getting same # of "COND" and "NOT_UTD" as expected for VAR1) below&lt;/P&gt;
&lt;P&gt;Any help you can give is much appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data table6;
  set table5;
  
  *--define int_status;
  int_status=status;

  *--define cond or not_utd for var1;
if var1dosenum=4 and (startdate-lastvar1&amp;lt;170) then finstatus_d="COND";
    else if var1dosenum=3 and startdate-lastvar1&amp;lt;170 then finstatus_d="COND";
    else if var1dosenum=2 and startdate-lastvar1&amp;lt;20 then finstatus_d="COND";
    else if var1dosenum=1 and startdate-lastvar1&amp;lt;20 then finstatus_d="COND";
    else finstatus_d="NOT_UTD";

run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 19:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518189#M3499</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-03T19:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518205#M3500</link>
      <description>&lt;P&gt;The logic looks equivalent to me. Are there some missing values among variables var1dosenum, startdate, or lastvar1?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 19:33:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518205#M3500</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-12-03T19:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518220#M3502</link>
      <description>&lt;P&gt;Those are nested, since it's IIF.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think using IFN would help you see it more clearly. This is untested, but the approach you likely want to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ifn(var1dosenum in (3,4) and (startdate-lastvar)&amp;lt;170, "COND", 
	ifn(var1dosenum in (1,2) and (startdate-lastvar)&amp;lt;20, "COND", 
	"NOT_UTD"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40498"&gt;@jcis7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;G'day!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to convert MS Access SQL Query code someone left in&amp;nbsp;to SAS Code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code in MS Access:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; TABLE1.STATUS AS IntStatus, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;170&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;170&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;IIf([VAR1DOSENUM]=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; And [STARTDATE]-[LASTVAR1]&amp;lt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"COND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"NOT_UTD"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)))) &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AS FinStatus_D&lt;/P&gt;
&lt;P&gt;FROM TABLE1 INNER JOIN TABLE5 TABLE1.ID = TABLE5.ID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;______________________________________________&lt;/P&gt;
&lt;P&gt;I've pasted my unsuccessful SAS code (not getting errors in log.&amp;nbsp;Just not getting same # of "COND" and "NOT_UTD" as expected for VAR1) below&lt;/P&gt;
&lt;P&gt;Any help you can give is much appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data table6;
  set table5;
  
  *--define int_status;
  int_status=status;

  *--define cond or not_utd for var1;
if var1dosenum=4 and (startdate-lastvar1&amp;lt;170) then finstatus_d="COND";
    else if var1dosenum=3 and startdate-lastvar1&amp;lt;170 then finstatus_d="COND";
    else if var1dosenum=2 and startdate-lastvar1&amp;lt;20 then finstatus_d="COND";
    else if var1dosenum=1 and startdate-lastvar1&amp;lt;20 then finstatus_d="COND";
    else finstatus_d="NOT_UTD";

run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 20:23:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518220#M3502</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-03T20:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518604#M3590</link>
      <description>Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Yes, there are ~800 missing for lastvar1 (same with the MS Access Query).  I'm not sure though what to do next?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Dec 2018 23:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518604#M3590</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-04T23:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518605#M3591</link>
      <description>Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Got it - I tried the IFC  and IFN and got the same numbers as using the initial code I posted so that is helpful to know a different way of coding!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm still getting a 40 count discrepancy between 'COND' in the MS Access query vs the SAS Freq Count (~40 more in the SAS Freq count).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm stumped.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Dec 2018 23:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518605#M3591</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-04T23:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518618#M3594</link>
      <description>I think the issue should be more so, which one is correct. It sounds like you have a possible order of operations type issue.</description>
      <pubDate>Wed, 05 Dec 2018 00:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518618#M3594</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T00:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518667#M3602</link>
      <description>&lt;P&gt;The problem most likely comes from the way missing values compare in SAS and in Access.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If X is missing,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Access IIF(X&amp;lt;10,"Small","Big") will return "Big" because the logical operation yields a missing (null) value and the function interprets Null as false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For SAS, IFC(X&amp;lt;10,"Small","Big")&amp;nbsp;will return "Small" because missing values are considered smaller than any non missing number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could make SAS behaviour similar to Access by inverting the comparisons:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table6;
  set table5;
  
  *--define int_status;
  int_status=status;

  *--define cond or not_utd for var1;
         if var1dosenum=4 and lastvar1-startdate&amp;gt;-170 then finstatus_d="COND";
    else if var1dosenum=3 and lastvar1-startdate&amp;gt;-170 then finstatus_d="COND";
    else if var1dosenum=2 and lastvar1-startdate&amp;gt;-20  then finstatus_d="COND";
    else if var1dosenum=1 and lastvar1-startdate&amp;gt;-20  then finstatus_d="COND";
    else finstatus_d="NOT_UTD";

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 05:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518667#M3602</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-12-05T05:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518984#M3693</link>
      <description>Thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 23:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518984#M3693</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-05T23:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518989#M3695</link>
      <description>Thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Lastvar1 was missing for those observations and when SAS tried to compute ( lastvar1-startdate), the value was missing.&lt;BR /&gt;&lt;BR /&gt;So SAS treated those children as falling into the "COND" category.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What does &amp;lt;- mean? I'm familiar with &amp;lt;= but not &amp;lt;-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Exactly as you said.    Appreciate your explanation!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 23:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518989#M3695</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-05T23:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518992#M3698</link>
      <description>The - is negative in front of the number, not part of the equality statement.</description>
      <pubDate>Wed, 05 Dec 2018 23:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/518992#M3698</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T23:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519003#M3705</link>
      <description>&lt;P&gt;You should add some parentheses to your condition(s) to clarify what order you want the operators performed.&lt;/P&gt;
&lt;P&gt;You posted:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;[VAR1DOSENUM]=4 And [STARTDATE]-[LASTVAR1]&amp;lt;170&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is that&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;([VAR1DOSENUM]=4) And (  ([STARTDATE]-[LASTVAR1]) &amp;lt; 170 )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;( ([VAR1DOSENUM]=4)  And [STARTDATE] ) - ([LASTVAR1]&amp;lt;170)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or some other permutation?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 01:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519003#M3705</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-06T01:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519004#M3706</link>
      <description>&lt;P&gt;What types of values&amp;nbsp;do STARTDATE and LASTDATE contain?&lt;/P&gt;
&lt;P&gt;Are they date values so that the difference is in days?&lt;/P&gt;
&lt;P&gt;Or are they datetime values so that the difference is in seconds?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 01:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519004#M3706</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-12-06T01:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519014#M3707</link>
      <description>&lt;P&gt;The expression &lt;EM&gt;lastvar1&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;startdate&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-170&lt;/SPAN&gt;&amp;nbsp;&lt;/EM&gt;reads "the difference between &lt;EM&gt;lastvar1&lt;/EM&gt; and &lt;EM&gt;startdate&lt;/EM&gt; greater than -170"&lt;/P&gt;
&lt;P&gt;When&amp;nbsp;neither &lt;EM&gt;lastvar1&lt;/EM&gt;&amp;nbsp;or &lt;EM&gt;startdate&lt;/EM&gt; is missing, that expression is equivalent to &lt;EM&gt;startdate-lastvar1&amp;lt;&lt;/EM&gt;&lt;SPAN class="token number"&gt;&lt;EM&gt;170&lt;/EM&gt;. But when &lt;EM&gt;lastvar1&lt;/EM&gt; is missing, the former yields &lt;STRONG&gt;false&lt;/STRONG&gt; while the later gives &lt;STRONG&gt;true&lt;/STRONG&gt;.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 05:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519014#M3707</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-12-06T05:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519170#M3743</link>
      <description>Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2018 15:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519170#M3743</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-06T15:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519171#M3744</link>
      <description>It's:  ([VAR1DOSENUM]=4) And (  ([STARTDATE]-[LASTVAR1]) &amp;lt; 170 )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2018 15:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519171#M3744</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-06T15:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519193#M3746</link>
      <description>Q1:  What types of values do STARTDATE and LASTDATE contain?&lt;BR /&gt;&lt;BR /&gt; A1: Start date I entered programmed into  SAS as:  startdate=  '05-SEP-2017'd; but converts to 21067 in the SAS dataset&lt;BR /&gt;&lt;BR /&gt;lastdate is a SAS date (datetime imported from MS Access (so it looks like in the SAS dataset 18APR2012:00:00:00 at first and then I converted to SAS date using datepart below so it becomes a SAS date)  An example of lastdate is:  lastdate=19254&lt;BR /&gt;&lt;BR /&gt;Q2:  Are they date values so that the difference is in days?&lt;BR /&gt;&lt;BR /&gt;A2: They are in datetime in MS Access but when I imported to SAS, I used datepart to convert it to SAS day in an array called newdates:&lt;BR /&gt;do i=1 to dim(date);&lt;BR /&gt;&lt;BR /&gt;  newdate(i)=datepart(date(i));&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;Q3:  Or are they datetime values so that the difference is in seconds?&lt;BR /&gt;&lt;BR /&gt;A3:  They are in days.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2018 16:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519193#M3746</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-06T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert MS Access SQL query to SAS Code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519246#M3750</link>
      <description>Got It!  This works now!  Thank you all so very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2018 19:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-MS-Access-SQL-query-to-SAS-Code/m-p/519246#M3750</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2018-12-06T19:29:39Z</dc:date>
    </item>
  </channel>
</rss>

