<?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: PROC SQL - Double select not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853141#M337224</link>
    <description>&lt;P&gt;There is a&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0rrwqm16uiv4vn1t0jj0jvidgao.htm" target="_blank" rel="noopener"&gt;LOWCASE&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0ilulfezdl4ykn17295t8tnh4xc.htm" target="_blank" rel="noopener"&gt;UPCASE&lt;/A&gt;&amp;nbsp;function in the SAS documentation, but you won't find LOWER or UPPER.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 19:39:10 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-01-10T19:39:10Z</dc:date>
    <item>
      <title>PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849062#M335701</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please let me know why this code is not working? I can't spot the error &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql ;
select
&amp;nbsp; usi,product_name,device_launch_date,price_at_launch
from&amp;nbsp;(
	select
  	h.usi,  
  	lower(h.product_name) as product_name, d.device_launch_date, d.price_at_launch
  	from cdm_uat2.product_holding_track h
  	left join cdm_uat2.device_ref d
  	on h.product_id= d.sku
  	where d.product_type_1= 'handset') a; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;log is not helpful&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class=""&gt;81&lt;/DIV&gt;&lt;DIV class=""&gt;82 proc sql ;&lt;/DIV&gt;&lt;DIV class=""&gt;83 select&lt;/DIV&gt;&lt;DIV class=""&gt;84 &amp;nbsp; usi,product_name,device_launch_date,price_at_launch&lt;/DIV&gt;&lt;DIV class=""&gt;---&lt;/DIV&gt;&lt;DIV class=""&gt;22&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, ',', -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, AS,&lt;/DIV&gt;&lt;DIV class=""&gt;CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/DIV&gt;&lt;DIV class=""&gt;85 from&amp;nbsp;(&lt;/DIV&gt;&lt;DIV class=""&gt;-&lt;/DIV&gt;&lt;DIV class=""&gt;22&lt;/DIV&gt;&lt;DIV class=""&gt;76&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 22-322: Syntax error, expecting one of the following: ',', EXCEPT, GROUP, HAVING, INTERSECT, JOIN, ORDER, UNION, WHERE.&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;&lt;DIV class=""&gt;86 select&lt;/DIV&gt;&lt;DIV class=""&gt;87 h.usi,&lt;/DIV&gt;&lt;DIV class=""&gt;88 lower(h.product_name) as product_name, d.device_launch_date, d.price_at_launch&lt;/DIV&gt;&lt;DIV class=""&gt;89 from cdm_uat2.product_holding_track h&lt;/DIV&gt;&lt;DIV class=""&gt;90 left join cdm_uat2.device_ref d&lt;/DIV&gt;&lt;DIV class=""&gt;91 on h.product_id= d.sku&lt;/DIV&gt;&lt;DIV class=""&gt;92 where d.product_type_1= 'handset') a;&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/DIV&gt;&lt;DIV class=""&gt;93 quit;&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/DIV&gt;&lt;DIV class=""&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class=""&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;94&lt;/DIV&gt;&lt;DIV class=""&gt;95 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class=""&gt;111&lt;/DIV&gt;&lt;PRE class=""&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 11:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849062#M335701</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2022-12-12T11:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849070#M335703</link>
      <description>&lt;P&gt;From now on, please preserve the formatting of the log (making it easier to read) by clicking on the &amp;lt;/&amp;gt; icon and pasting the log into the window that appears. We're trying to help you, but you have to help us.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no LOWER function in SAS. You need to use the LOWCASE function.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 12:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849070#M335703</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-12T12:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849078#M335710</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270435"&gt;@jorquec&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good news: Your code works for me with dummy data that I've created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I am using a local SAS 9.4 installation with the traditional Display Manager interface. I suspect that you are using SAS Studio or a similar browser-based user interface so that the &lt;EM&gt;tab characters&lt;/EM&gt;, which you used for code indentation, or maybe other invisible characters in your code are not treated as blanks, hence the error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove at least the leading white-space characters in each line and retype them as ordinary spaces. Or use the "search and replace" feature of your user interface to replace tabs with spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make similar issues less likely to occur in the future, modify the editor options regarding tab characters as shown by &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt; in&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-will-not-read-my-3-columns-of-data/m-p/845541/highlight/true#M334280" target="_blank" rel="noopener"&gt;Re: SAS will not read my 3 columns of data&lt;/A&gt;. And in general, &lt;EM&gt;avoid tab characters in SAS code&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 12:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/849078#M335710</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-12-12T12:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853132#M337223</link>
      <description>there is a lower (and upper) function in SAS data step and non-passthrough SQL. pass-through uses upcase and lowcase</description>
      <pubDate>Tue, 10 Jan 2023 19:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853132#M337223</guid>
      <dc:creator>gema</dc:creator>
      <dc:date>2023-01-10T19:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853141#M337224</link>
      <description>&lt;P&gt;There is a&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0rrwqm16uiv4vn1t0jj0jvidgao.htm" target="_blank" rel="noopener"&gt;LOWCASE&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0ilulfezdl4ykn17295t8tnh4xc.htm" target="_blank" rel="noopener"&gt;UPCASE&lt;/A&gt;&amp;nbsp;function in the SAS documentation, but you won't find LOWER or UPPER.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 19:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853141#M337224</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-10T19:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853153#M337228</link>
      <description>&lt;P&gt;I copied the text you posted and saved it to a file.&amp;nbsp; It appears to have some random TAB characters inserted.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;421  data _null_;
422    infile 'c:\downloads\sql.sas';
423    input;
424    list;
425  run;

NOTE: The infile 'c:\downloads\sql.sas' is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         proc sql ; 10
2         select 6
3           usi,product_name,device_launch_date,price_at_launch 53
4         from ( 6
5   CHAR  .select 7
    ZONE  0766667
    NUMR  935C534

6   CHAR    .h.usi,   11
    ZONE  22062776222
    NUMR  0098E539C00

7   CHAR    .lower(h.product_name) as product_name, d.device_launch_date, d.price_at_launch 81
    ZONE  220667672627766767566662267277667675666622626676665667666566762262776665675667666
    NUMR  009CF75288E02F4534FE1D59013002F4534FE1D5C04E456935FC15E38F4145C04E02935F14FC15E38

8   CHAR    .from cdm_uat2.product_holding_track h 40
    ZONE  2206766266657673277667675666666657766626
    NUMR  00962FD034DF5142E02F4534F8FC49E7F4213B08

9   CHAR    .left join cdm_uat2.device_ref d 34
    ZONE  2206667266662666576732667666576626
    NUMR  009C5640AF9E034DF5142E456935F25604

10  CHAR    .on h.product_id= d.sku 25
    ZONE  2206626277667675663262767
    NUMR  009FE08E02F4534F94D04E3B5

11  CHAR    .where d.product_type_1= 'handset') a;  41
    ZONE  22076676262776676757776533226666767222632
    NUMR  0097852504E02F4534F4905F1D0781E43547901B0
12        quit; 5
NOTE: 12 records were read from the infile (system-specific pathname).
      The minimum record length was 5.
      The maximum record length was 81.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

&lt;/PRE&gt;
&lt;P&gt;With the editor window in SAS/Studio you can actually embed tab characters into the file and the way that SAS/Studio works behind the scenes to send the code to SAS to execute does NOT replace the tabs with spaces&lt;/P&gt;
&lt;PRE&gt; 69         data _null_;
 70           infile cards;
 71           input;
 72           list;
 73         cards4;
 
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 74         proc sql ;
 75         select
 76           usi,product_name,device_launch_date,price_at_launch
 77         from (
 
 78  CHAR   .select                                                                         
     ZONE   07666672222222222222222222222222222222222222222222222222222222222222222222222222
     NUMR   935C5340000000000000000000000000000000000000000000000000000000000000000000000000
 
 79  CHAR     .h.usi,                                                                       
     ZONE   22062776222222222222222222222222222222222222222222222222222222222222222222222222
     NUMR   0098E539C00000000000000000000000000000000000000000000000000000000000000000000000
 
 80  CHAR     .lower(h.product_name) as product_name, d.device_launch_date, d.price_at_launch                   
     ZONE   2206676726277667675666622672776676756666226266766656676665667622627766656756676662222222222222222222
     NUMR   009CF75288E02F4534FE1D59013002F4534FE1D5C04E456935FC15E38F4145C04E02935F14FC15E380000000000000000000
       101                                                              
 
 81  CHAR     .from cdm_uat2.product_holding_track h                                                            
     ZONE   2206766266657673277667675666666657766626222222222222222222222222222222222222222222222222222222222222
     NUMR   00962FD034DF5142E02F4534F8FC49E7F4213B08000000000000000000000000000000000000000000000000000000000000
       101                                                              
 
 82  CHAR     .left join cdm_uat2.device_ref d                                                                  
     ZONE   2206667266662666576732667666576626222222222222222222222222222222222222222222222222222222222222222222
     NUMR   009C5640AF9E034DF5142E456935F25604000000000000000000000000000000000000000000000000000000000000000000
       101                                                              
 
 83  CHAR     .on h.product_id= d.sku                                                                           
     ZONE   2206626277667675663262767222222222222222222222222222222222222222222222222222222222222222222222222222
     NUMR   009FE08E02F4534F94D04E3B5000000000000000000000000000000000000000000000000000000000000000000000000000
       101                                                              
 
 84  CHAR     .where d.product_type_1= 'handset') a;                                                            
     ZONE   2207667626277667675777653322666676722263222222222222222222222222222222222222222222222222222222222222
     NUMR   0097852504E02F4534F4905F1D0781E43547901B000000000000000000000000000000000000000000000000000000000000
       101                                                              
 85         quit;
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds&lt;/PRE&gt;
&lt;P&gt;(unlike when you do the same thing with the normal SAS editor in SAS Display Manager).&lt;/P&gt;
&lt;PRE&gt;438  data _null_;
439    infile cards;
440    input;
441    list;
442  cards4;

RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
443        proc sql ;
444        select
445          usi,product_name,device_launch_date,price_at_launch
446        from (
447          select
448            h.usi,
449            lower(h.product_name) as product_name, d.device_launch_date, d.price_at_launch
450            from cdm_uat2.product_holding_track h
451            left join cdm_uat2.device_ref d
452            on h.product_id= d.sku
453            where d.product_type_1= 'handset') a;
454        quit;&lt;/PRE&gt;
&lt;P&gt;But that is probably NOT your problem as (at least with SAS/Studio 3.71) the tabs in CODE do not cause any trouble.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that some of the spaces that you posted might actually be some other invisible character.&amp;nbsp; That is confusing SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 20:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853153#M337228</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-10T20:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - Double select not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853155#M337229</link>
      <description>&lt;P&gt;PROC SQL supports the LOWER() function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="xisDoc-noteGenText"&gt;Note:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;The LOWER function is provided for compatibility with the ANSI SQL standard. You can also use the SAS function LOWCASE.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But in normal SAS code you need to use the real SAS function and not the SQL function.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 20:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-Double-select-not-working/m-p/853155#M337229</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-10T20:30:24Z</dc:date>
    </item>
  </channel>
</rss>

