<?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: translating a Microsoft Access SQL query to A SAS Proc SQL query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381418#M276988</link>
    <description>&lt;P&gt;That's where the brackets are important. I think the AND/OR connects them but they are different conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format your code using the brackets so you can identify the filters. Put it into logic and then convert that logic into SAS code, for example you can use IN instead of multiple ORs&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 15:36:58 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-27T15:36:58Z</dc:date>
    <item>
      <title>translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380390#M276978</link>
      <description>&lt;P&gt;SELECT CUSTOMER_NUMBER, BUSLINE_GROUPING, IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]) AS GrwthALT_LEVEL2_DESC, Sum(YTDCYNET_QTY) AS SumOfYTDCYNET_QTY, Sum(YTDPYNET_QTY) AS SumOfYTDPYNET_QTY, Sum(YTDCYNET_SALES) AS SumOfYTDCYNET_SALES, Sum(YTDPYNET_SALES) AS SumOfYTDPYNET_SALES FROM [C-Expanded PVM from Sushant] GROUP BY CUSTOMER_NUMBER, BUSLINE_GROUPING, IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]), ALT_LEVEL2_DESC, ALT_LEVEL1_DESC, BUSLINE, MATERIAL_NUMBER HAVING (((ALT_LEVEL2_DESC)="HIP HEADS" Or (ALT_LEVEL2_DESC)="HIP LINER" Or (ALT_LEVEL2_DESC)="HIP SHELLS" Or (ALT_LEVEL2_DESC)="HIP STEMS" Or (ALT_LEVEL2_DESC)="KNEE FEMORAL") AND ((ALT_LEVEL1_DESC) Not Like "ZUK *") AND ((BUSLINE)&amp;lt;&amp;gt;"4545") AND ((MATERIAL_NUMBER) Not Like "719*" And ([C-Expanded MATERIAL_NUMBER) Not Like "7170*")) OR (((ALT_LEVEL2_DESC)="HIP HEADS" Or (ALT_LEVEL2_DESC)="HIP LINER" Or (ALT_LEVEL2_DESC)="HIP SHELLS" Or (ALT_LEVEL2_DESC)="HIP STEMS" Or (ALT_LEVEL2_DESC)="KNEE FEMORAL") AND ((ALT_LEVEL1_DESC) Not Like "ZUK *") AND ((BUSLINE)&amp;lt;&amp;gt;"4545") AND ((MATERIAL_NUMBER) Not Like "719*" And (MATERIAL_NUMBER) Not Like "7170*")) OR (((ALT_LEVEL2_DESC)="KNEE REVISION") AND ((ALT_LEVEL1_DESC) Like "*fem*") AND ((MATERIAL_NUMBER) Not Like "719*" And (MATERIAL_NUMBER) Not Like "7170*")) OR (((ALT_LEVEL2_DESC)="KNEE REVISION") AND ((ALT_LEVEL1_DESC) Like "*fem*") AND ((MATERIAL_NUMBER) Not Like "719*" And (MATERIAL_NUMBER) Not Like "7170*"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above SQL query is in an Access database. I'm trying to translate it in SAS and am having an awful time. I don't have a lot of experience with Access but&amp;nbsp;I did translate this to the below SAS query. however this query doesn't create the exact same export as the Access query. It comes close, but doesn't exactly fit. There may be a situation where there are duplicate rows in the access query, but i'm not sure yet. (yes the IIF statement in the Access query is not a typo. it's exactly what came out of the view SQL part of the Access database.&amp;nbsp;I thought it was a typo on my part, but it isn't.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Custpvm_recon_Compnts_exclZUK &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&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; CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC, SUM(YTDCYNET_QTY) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDCYNET_QTY,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;SUM(YTDPYNET_QTY) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDPYNET_QTY,SUM(YTDCYNET_SALES) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDCYNET_SALES,SUM(YTDPYNET_SALES) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDPYNET_SALES&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;WHERE&lt;/FONT&gt; &lt;FONT face="Courier New" size="2"&gt;MATERIAL_NUMBER &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"719%"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; MATERIAL_NUMBER &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"7170%"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (ALT_LEVEL2_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP HEADS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP LINER"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP SHELLS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP STEMS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"KNEE FEMORAL"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; BUSLINE &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"4545"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ALT_LEVEL1_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"ZUK%"&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;OR (Alt_level2_Desc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"KNEE REVISION"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ALT_LEVEL1_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"%FEM%"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;group&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC,ALT_LEVEL2_DESC,ALT_LEVEL1_DESC,BUSLINE,MATERIAL_NUMBER&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;quit&lt;/FONT&gt;&lt;/STRONG&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;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I know this isn't much to go by, but I was trying to see if anyone could tell me what i'm doing wrong.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Jose&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 14:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380390#M276978</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T14:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380529#M276979</link>
      <description>&lt;P&gt;Hard to say w/o some testing on the real data. I would start with making sure the comparisons are correct. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;BUSLINE&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;NOT&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"4545"&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;Are you matching correctly here? For example, what if BUSLINE is " 4545" or "4545 " ? Strip/trim as needed to get a valid match. Same goes for any other string field you are working with.&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;</description>
      <pubDate>Thu, 27 Jul 2017 14:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380529#M276979</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-07-27T14:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380972#M276980</link>
      <description>&lt;P&gt;Thanks for the quick response.. BUSLINE &amp;nbsp;is a character field, but its really a 4 digit number.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 14:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/380972#M276980</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T14:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381053#M276981</link>
      <description>&lt;P&gt;Well, it is not a number unless held as such in Access. In Access, is it defined as a number or a string? If string, it needs to be trimmed/stripped before a comparison to be safe. See how it is held as the column type and then trim/strip if it is a string/char.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may/may not be the issue but it would be where I would start.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381053#M276981</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-07-27T15:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381059#M276982</link>
      <description>&lt;P&gt;IFF are CASE statements, or similar to an IF condition in Excel&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381059#M276982</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-27T15:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381074#M276983</link>
      <description>&lt;P&gt;No have I experience with access sql. Anyway I have some note:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) You have not translate line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]) AS GrwthALT_LEVEL2_DESC, &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;which, probably, be translated into CASE, WHEN statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) You have the IIF statement within the GROUP BY statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; I don't &amp;nbsp;see that you relate to it and I don't know is it possible in sas sql&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Check your code if you have all values in IN statement as in the qccess sql ( var=value1 or var=value2 ..)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Check carefully the parentheses especially when using OR / AND&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5) here is the access sql in idented format to make more readable and make it easier to other to help you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SELECT 
   CUSTOMER_NUMBER, 
   BUSLINE_GROUPING, 
   IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]) AS GrwthALT_LEVEL2_DESC, 
   Sum(YTDCYNET_QTY) AS SumOfYTDCYNET_QTY, 
   Sum(YTDPYNET_QTY) AS SumOfYTDPYNET_QTY, 
   Sum(YTDCYNET_SALES) AS SumOfYTDCYNET_SALES, 
   Sum(YTDPYNET_SALES) AS SumOfYTDPYNET_SALES 
   FROM [C-Expanded PVM from Sushant] 
   GROUP BY CUSTOMER_NUMBER, BUSLINE_GROUPING, 
            IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]), 
			ALT_LEVEL2_DESC, ALT_LEVEL1_DESC, BUSLINE, MATERIAL_NUMBER 
   HAVING (((ALT_LEVEL2_DESC)="HIP HEADS" Or 
          (ALT_LEVEL2_DESC)="HIP LINER" Or 
		  (ALT_LEVEL2_DESC)="HIP SHELLS" Or 
		  (ALT_LEVEL2_DESC)="HIP STEMS" Or 
		  (ALT_LEVEL2_DESC)="KNEE FEMORAL") AND 
		  ((ALT_LEVEL1_DESC) Not Like "ZUK *") AND 
		  ((BUSLINE)&amp;lt;&amp;gt;"4545") AND 
		  ((MATERIAL_NUMBER) Not Like "719*" And 
		  ([C-Expanded MATERIAL_NUMBER) Not Like "7170*")) OR 
		  (((ALT_LEVEL2_DESC)="HIP HEADS" Or 
		    (ALT_LEVEL2_DESC)="HIP LINER" Or 
		    (ALT_LEVEL2_DESC)="HIP SHELLS" Or 
		    (ALT_LEVEL2_DESC)="HIP STEMS" Or 
		    (ALT_LEVEL2_DESC)="KNEE FEMORAL") AND 
		   ((ALT_LEVEL1_DESC) Not Like "ZUK *") AND 
		  ((BUSLINE)&amp;lt;&amp;gt;"4545") AND 
		  ((MATERIAL_NUMBER) Not Like "719*" And 
		   (MATERIAL_NUMBER) Not Like "7170*")) OR 
		  (((ALT_LEVEL2_DESC)="KNEE REVISION") AND 
		   ((ALT_LEVEL1_DESC) Like "*fem*") AND 
		   ((MATERIAL_NUMBER) Not Like "719*" And 
		   (MATERIAL_NUMBER) Not Like "7170*")) OR 
		 (((ALT_LEVEL2_DESC)="KNEE REVISION") AND 
		  ((ALT_LEVEL1_DESC) Like "*fem*") AND 
		  ((MATERIAL_NUMBER) Not Like "719*" And 
		  (MATERIAL_NUMBER) Not Like "7170*"))
    ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381074#M276983</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-27T15:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381127#M276984</link>
      <description>&lt;P&gt;Your 'HAVING' doesn't deal with aggregates so it likely needs to be WHERE, not HAVING&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381127#M276984</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-27T15:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381314#M276985</link>
      <description>sorry I forgot to add a datastep that I did earlier in the code.data ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v3;&lt;BR /&gt;FORMAT GrwthALT_LEVEL2_DESC $32.;&lt;BR /&gt;set ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v2;&lt;BR /&gt;if BUSLINE_GROUPING = "KNEES" THEN GrwthALT_LEVEL2_DESC = "1" ;&lt;BR /&gt;else GrwthALT_LEVEL2_DESC = ALT_LEVEL2_DESC;&lt;BR /&gt;;run;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table Custpvm_recon_Compnts_exclZUK as&lt;BR /&gt;select CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC, SUM(YTDCYNET_QTY) AS SumOfYTDCYNET_QTY,&lt;BR /&gt;SUM(YTDPYNET_QTY) AS SumOfYTDPYNET_QTY,SUM(YTDCYNET_SALES) AS SumOfYTDCYNET_SALES,SUM(YTDPYNET_SALES) AS SumOfYTDPYNET_SALES&lt;BR /&gt;FROM ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v3&lt;BR /&gt;WHERE MATERIAL_NUMBER NOT LIKE "719%"&lt;BR /&gt;AND MATERIAL_NUMBER NOT LIKE "7170%"&lt;BR /&gt;AND (ALT_LEVEL2_DESC IN ("HIP HEADS","HIP LINER","HIP SHELLS","HIP STEMS","KNEE FEMORAL")AND BUSLINE NOT in("4545")AND ALT_LEVEL1_DESC NOT LIKE ("ZUK %"))&lt;BR /&gt;OR (Alt_level2_Desc in ("KNEE REVISION") AND ALT_LEVEL1_DESC LIKE ("%FEM%"))&lt;BR /&gt;group by CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC,ALT_LEVEL2_DESC,ALT_LEVEL1_DESC,BUSLINE,MATERIAL_NUMBER&lt;BR /&gt;;quit;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381314#M276985</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T15:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381349#M276986</link>
      <description>&lt;P&gt;from what I can tell that IIF statement is basically saying if the BUSLINE GROUPING is equal to "KNEES" then GrwthALT_LEVEL2_DESC is equal to "1", otherwise&amp;nbsp; GrwthALT_LEVEL2_DESC is equal to&amp;nbsp; ALT_LEVEL2_DESC.&amp;nbsp; that's what i did in the data step prior to the PROC SQL.&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;</description>
      <pubDate>Thu, 27 Jul 2017 15:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381349#M276986</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T15:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381385#M276987</link>
      <description>&lt;P&gt;the&amp;nbsp;HAVING statement is where i'm having trouble with to me it seems that it's repeating the exact same thing twice...&amp;nbsp; for "HIP HEADS" and "HIP LINERS" and "HIP SHELLS" and "HIP STEMS" and "KNEE FEMORAL".. isn't the double statement redundant?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381385#M276987</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381418#M276988</link>
      <description>&lt;P&gt;That's where the brackets are important. I think the AND/OR connects them but they are different conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format your code using the brackets so you can identify the filters. Put it into logic and then convert that logic into SAS code, for example you can use IN instead of multiple ORs&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 15:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/381418#M276988</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-27T15:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382081#M276989</link>
      <description>&lt;P&gt;First thing is learn to use the forum editor to include code so that it is not re-flowed as if it was normal paragraphs. Use the Insert SAS Code icon to paste in the code. &amp;nbsp;Second format that code. I pasted your code to this free site &lt;A href="https://sqlformat.org" target="_blank"&gt;https://sqlformat.org&lt;/A&gt; and it did a pretty good job. Only thing I had to do was move the commas and semi-colon from the end of the lines to the beginning of the next line where human eyes can see them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SELECT CUSTOMER_NUMBER
     , BUSLINE_GROUPING
     , IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC]) AS GrwthALT_LEVEL2_DESC
     , Sum(YTDCYNET_QTY) AS SumOfYTDCYNET_QTY
     , Sum(YTDPYNET_QTY) AS SumOfYTDPYNET_QTY
     , Sum(YTDCYNET_SALES) AS SumOfYTDCYNET_SALES
     , Sum(YTDPYNET_SALES) AS SumOfYTDPYNET_SALES
FROM [C-Expanded PVM from Sushant]
GROUP BY CUSTOMER_NUMBER 
       , BUSLINE_GROUPING 
       , IIf([BUSLINE_GROUPING]="Knees",1,[ALT_LEVEL2_DESC])
       , ALT_LEVEL2_DESC
       , ALT_LEVEL1_DESC 
       , BUSLINE 
       , MATERIAL_NUMBER
HAVING (((ALT_LEVEL2_DESC)="HIP HEADS"
         OR (ALT_LEVEL2_DESC)="HIP LINER"
         OR (ALT_LEVEL2_DESC)="HIP SHELLS"
         OR (ALT_LEVEL2_DESC)="HIP STEMS"
         OR (ALT_LEVEL2_DESC)="KNEE FEMORAL")
        AND ((ALT_LEVEL1_DESC) NOT LIKE "ZUK *")
        AND ((BUSLINE)&amp;lt;&amp;gt;"4545")
        AND ((MATERIAL_NUMBER) NOT LIKE "719*"
             AND ([C-Expanded MATERIAL_NUMBER) NOT LIKE "7170*"))
OR (((ALT_LEVEL2_DESC)="HIP HEADS"
     OR (ALT_LEVEL2_DESC)="HIP LINER"
     OR (ALT_LEVEL2_DESC)="HIP SHELLS"
     OR (ALT_LEVEL2_DESC)="HIP STEMS"
     OR (ALT_LEVEL2_DESC)="KNEE FEMORAL")
    AND ((ALT_LEVEL1_DESC) NOT LIKE "ZUK *")
    AND ((BUSLINE)&amp;lt;&amp;gt;"4545")
    AND ((MATERIAL_NUMBER) NOT LIKE "719*"
         AND (MATERIAL_NUMBER) NOT LIKE "7170*"))
OR (((ALT_LEVEL2_DESC)="KNEE REVISION")
    AND ((ALT_LEVEL1_DESC) LIKE "*fem*")
    AND ((MATERIAL_NUMBER) NOT LIKE "719*"
         AND (MATERIAL_NUMBER) NOT LIKE "7170*"))
OR (((ALT_LEVEL2_DESC)="KNEE REVISION")
    AND ((ALT_LEVEL1_DESC) LIKE "*fem*")
    AND ((MATERIAL_NUMBER) NOT LIKE "719*"
         AND (MATERIAL_NUMBER) NOT LIKE "7170*"))
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to fix the SQL/Server specfic stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Remove the square brackets [] around variable and dataset names. &amp;nbsp;If you are using VALIDVARNAME=ANY and/or VALIDMEMNAME=EXTEND then you will need format them as name literals. Otherwise use the real name and not the ones with spaces in them.
&lt;UL&gt;
&lt;LI&gt;This looks like a typo, there is a missing right bracket. &amp;nbsp;Was that in your original code? &amp;nbsp;Does that mess up the nesting of the () in the HAVING clause?&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;             AND ('C-Expanded MATERIAL_NUMBER'n NOT LIKE "7170*"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;Convert the IFF() function to something SAS can use.
&lt;UL&gt;
&lt;LI&gt;You could convert to normal SQL. Make sure both values are using the same type! &amp;nbsp;I doubt that ALT_LEVEL2_DESC is a numeric variable.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     , case when (BUSLINE_GROUPING="Knees") then '1'
            else ALT_LEVEL2_DESC 
       end AS GrwthALT_LEVEL2_DESC&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or use the SAS function IFC()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     , ifc(BUSLINE_GROUPING="Knees",'1',ALT_LEVEL2_DESC) AS GrwthALT_LEVEL2_DESC&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is another one in the GROUP BY, but it looks like the same thing as before, so use the CALCULATED keyword to just refer to the value you already calculated in this SELECT statement. &amp;nbsp;Note no need for CALCULATED&amp;nbsp;keyword if you have already created this variable in an extra step that it is just a normal reference to a variable coming form the input dataset and not a reference to something that was derived in this SELECT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;GROUP BY CUSTOMER_NUMBER 
       , BUSLINE_GROUPING 
       , calculated GrwthALT_LEVEL2_DESC
       , ALT_LEVEL2_DESC
       , ALT_LEVEL1_DESC 
       , BUSLINE 
       , MATERIAL_NUMBER&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also check the variables you reference in other places and make sure that they are not&amp;nbsp;references to varaibles created in this SELECT clause, but are the names of variables coming from the source table. &amp;nbsp;If they are then you will need to add the CALCULATED keyword there also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;What is with the * in the LIKE strings? Does SQL Server use * as wildcard instead of %? &amp;nbsp;Or do the values really contain the *, but if so then why is it using LIKE instead of just =?&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    AND ((ALT_LEVEL1_DESC) NOT LIKE 'ZUK %')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Personally I never use &amp;lt;&amp;gt; as an operator as it has two totally different meanings in SAS depending on whether you use it in normal SAS code or in SQL code (or WHERE statements). &amp;nbsp;But it should work the same in PROC SQL as it works in other SQL versions.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Finally &amp;nbsp;HAVING is applied after the observations have been calculated and WHERE applies to the data on the way into the SQL process. There is a big difference when you are using GROUP BY. It looks to me like you are referencing variables like BUSLINE that are not part of the data being output. &amp;nbsp;So you probably want to convert this HAVING clause to a WHERE clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 16:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382081#M276989</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-27T16:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382329#M276990</link>
      <description>&lt;P&gt;So apparently it's my Not like statements... for some reason in my sas query i'm saying that MATERIAL NUMBER is Not like "719%"&amp;nbsp; and MATERIAL NUMBER is Not LIKE "7170%"&amp;nbsp;. the out put excludes all material numbers with 7170 but keeps the 719 numbers... What would be the syntax to combinde the statements?&amp;nbsp; i.e. something like " MATERIAL_NUMBER not like ("719%" ,"7170%")... that doesn't work btw. does anyone know how to write that?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382329#M276990</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T17:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382367#M276991</link>
      <description>&lt;P&gt;You need to simplify your logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your not like issue, I would recommend using single quotes, so it doesn't try and resolve to a macro, but I would also recommend creating a new variable that is the first three characters and test that alone. You have multiple conditions that you'll likely be able to collapse when you do this.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382367#M276991</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-27T17:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382378#M276992</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/156064"&gt;@joseatmc&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So apparently it's my Not like statements... for some reason in my sas query i'm saying that MATERIAL NUMBER is Not like "719%"&amp;nbsp; and MATERIAL NUMBER is Not LIKE "7170%"&amp;nbsp;. the out put excludes all material numbers with 7170 but keeps the 719 numbers... What would be the syntax to combinde the statements?&amp;nbsp; i.e. something like " MATERIAL_NUMBER not like ("719%" ,"7170%")... that doesn't work btw. does anyone know how to write that?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;MATERIAL_NUMBER should be a character variable. Perhaps your '719%' values are really ' 719%' values.&lt;/P&gt;
&lt;P&gt;Try testing STRIP(MATERIAL_NUMBER) instead.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382378#M276992</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-27T17:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382453#M276993</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to fix the SQL/Server specfic stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Remove the square brackets [] around variable and dataset names. &amp;nbsp;If you are using VALIDVARNAME=ANY and/or VALIDMEMNAME=EXTEND then you will need format them as name literals. Otherwise use the real name and not the ones with spaces in them.&lt;UL&gt;&lt;LI&gt;This looks like a typo, there is a missing right bracket. &amp;nbsp;Was that in your original code? &amp;nbsp;Does that mess up the nesting of the () in the HAVING clause?&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;             AND ('C-Expanded MATERIAL_NUMBER'n NOT LIKE "7170*"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;UL&gt;&lt;UL&gt;Yes the Access query&amp;nbsp; referenced a table called C-Expanded PVM from Sushant in every&amp;nbsp; field trying to be returned ... i removed all of them but missed one. Sorry about that.&lt;/UL&gt;&lt;/UL&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;UL&gt;&lt;LI&gt;What is with the * in the LIKE strings? Does SQL Server use * as wildcard instead of %? &amp;nbsp;Or do the values really contain the *, but if so then why is it using LIKE instead of just =?&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    AND ((ALT_LEVEL1_DESC) NOT LIKE 'ZUK %')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes the * in the Access queery is the "wild card" like the % is SAS.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/382453#M276993</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T17:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/383172#M276994</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;here is the translation!!&amp;nbsp; finally figured it out!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;FORMAT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; GrwthALT_LEVEL2_DESC &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$32.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; BUSLINE_GROUPING = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"KNEES"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;THEN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; GrwthALT_LEVEL2_DESC = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"1"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;else&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; GrwthALT_LEVEL2_DESC = ALT_LEVEL2_DESC;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Custpvm_recon_Compnts_exclZUK &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&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; CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC,SUM(YTDCYNET_QTY) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDCYNET_QTY,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;SUM(YTDPYNET_QTY) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDPYNET_QTY,SUM(YTDCYNET_SALES) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDCYNET_SALES,SUM(YTDPYNET_SALES) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; SumOfYTDPYNET_SALES&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ORTHO_SALES_&amp;amp;FY._&amp;amp;PERIOD._ALT2v3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;WHERE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (ALT_LEVEL2_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP HEADS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP LINER"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP SHELLS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"HIP STEMS"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"KNEE FEMORAL"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; BUSLINE &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"4545"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ALT_LEVEL1_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"ZUK %"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Material_number &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;not&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;like&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"719%"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Material_number &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"7170%"&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;OR (Alt_level2_Desc &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"KNEE REVISION"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ALT_LEVEL1_DESC &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"%FEM%"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Material_number &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;not&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;like&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"719%"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Material_number &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;NOT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"7170%"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;group&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CUSTOMER_NUMBER,BUSLINE_GROUPING,GrwthALT_LEVEL2_DESC,ALT_LEVEL2_DESC,ALT_LEVEL1_DESC,BUSLINE,MATERIAL_NUMBER&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;quit&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/383172#M276994</guid>
      <dc:creator>joseatmc</dc:creator>
      <dc:date>2017-07-27T18:19:19Z</dc:date>
    </item>
  </channel>
</rss>

