Search code examples
sqlsaszos

SAS PROC SQL CREATE Statement not valid or out of order error


Can anyone help me resolve this error? It's in SAS 9.2.

275          PROC SQL;                                                      
276           CREATE TABLE WORK.MATCHREC AS                                 
              ______                                                        
              180                                                           
ERROR 180-322: Statement is not valid or it is used out of proper order.    
277           SELECT A.*,                                                   
278                  B.DSORG AS MDFLAG FORMAT=$2. LABEL='MATCHED DATA FLAG' 
279           FROM DAILY.SMFLIST A LEFT JOIN WORK.LISTDSN B                 
280           ON (A.DSNAME=B.DSNAME);                                       

281           QUIT; 

Solution

  • Adding a run; statement before proc sql resolved the problem. It must have cleaned up whatever was hanging and interfering with it.