DATA Step, Macro, Functions and more

PROC SQL error..Please help

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

PROC SQL error..Please help

44                                                                             
45           PROC SQL;                                                         
46             CREATE TABLE ENROLL2 AS                                         
47               A.*,                                                          
                 _                                                             
                 _                                                             
                 _                                                             
                 22                                                            
                 22                                                            
                 22                                                            
                  _                                                            
                  _                                                            
                  _                                                            
                  200                                                          

                  200                                                          
                  200                                                          
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.         
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.         
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.         
                                                                               
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.               
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.               
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.               
                                                                               
48               B.BENESSN,                                                    
49               B.EDIPN,                                                      
50               CASE                                                          
51                 WHEN TRIM(A.NAME3) NE TRIM(B.NAME3)                         
52                       THEN B.FIRSTNAME !! " " !! B.LASTNAME                 
53                 END AS NAMEMISMATCH                                         
54             FROM                                                            
55               BENE2B AS A LEFT JOIN ENROLL3 AS B                            
56                  ON (A.SPONSORSSN = B.SPONSORSSN                            
57                      AND A.PATIENTDOB = B.PATIENTDOB);                      
NOTE: PROC SQL SET OPTION NOEXEC AND WILL CONTINUE TO CHECK THE SYNTAX OF STATEM
58           QUIT;                                                             
NOTE: THE SAS SYSTEM STOPPED PROCESSING THIS STEP BECAUSE OF ERRORS.           
NOTE: THE PROCEDURE SQL USED 0.00 CPU SECONDS AND 15462K.                      
                                                                               
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A
                                                                               
59                                                                             

                                                                             
                                                                             
60           PROC SQL;                                                       
61             CREATE TABLE ENROLL2 AS                                       
62               A.*,                                                        
                 _                                                           
                 _                                                           
                 _                                                           
                 22                                                          
                 22                                                          
                 22                                                          
                  _                                                          
                  _                                                          
                  _                                                          
                  200                                                        
                  200                                                        
                  200                                                        
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.       
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.       
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.       
                                                                             
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.             
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.             
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.             
                                                                             
63               B.BENESSN,                                                  
64               B.EDIPN,                                                    
65               CASE                                                        

66                 WHEN TRIM(A.NAME3) NE TRIM(B.NAME3)                         
67                       THEN B.FIRSTNAME !! " " !! B.LASTNAME                 
68                 END AS NAMEMISMATCH                                         
69             FROM                                                            
70               BENE2B AS A LEFT JOIN ENROLL3 AS B                            
71                  ON (A.SPONSORSSN = B.SPONSORSSN                            
72                      AND A.PATIENTDOB = B.PATIENTDOB);                      
NOTE: PROC SQL SET OPTION NOEXEC AND WILL CONTINUE TO CHECK THE SYNTAX OF STATEM
73           QUIT;                                                             
NOTE: THE SAS SYSTEM STOPPED PROCESSING THIS STEP BECAUSE OF ERRORS.           
NOTE: THE PROCEDURE SQL USED 0.00 CPU SECONDS AND 15462K.                      
                                                                               
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A
                                                                               
74                                                                             
75                                                                             
                                                                               
                                                                               
76           PROC PRINT DATA=ENROLL2 (OBS=200); TITLE 'ENROLL2'; RUN;          
                                                                               
NOTE: THERE WERE 200 OBSERVATIONS READ FROM THE DATA SET WORK.ENROLL2.         
NOTE: THE PROCEDURE PRINT PRINTED PAGE 2.                                      
NOTE: THE PROCEDURE PRINT USED 0.00 CPU SECONDS AND 18662K.                    
                                                                               
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A
                                                                               
                                                                               
77                                                                             


Accepted Solutions
Solution
‎10-09-2017 11:48 AM
Regular Contributor
Posts: 234

Re: PROC SQL error..Please help

Hello,

The log indicates the problem. You forgot the SELECT keyword : CREATE TABLE XXX AS SELECT A.*,....

View solution in original post


All Replies
Solution
‎10-09-2017 11:48 AM
Regular Contributor
Posts: 234

Re: PROC SQL error..Please help

Hello,

The log indicates the problem. You forgot the SELECT keyword : CREATE TABLE XXX AS SELECT A.*,....
PROC Star
Posts: 755

Re: PROC SQL error..Please help

You are missing a select clause at line 62 Smiley Happy

Super User
Posts: 7,809

Re: PROC SQL error..Please help

As it says, next should come a select statement. Consult the proc sql documentation.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 125 views
  • 0 likes
  • 4 in conversation