Help with "ERROR: Invalid sequence of commands"

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Help with "ERROR: Invalid sequence of commands"

[ Edited ]

Hello,

 

My team is making the switch from SAS Desktop 9.4 to server-based SAS Enterprise Guide. 

 

I have one piece of fairly simple code that works properly in 9.4, but is is now producing the following error in enterprise guide:

 

 

ERROR: Invalid sequence of commands for file ORACLE.HAVE.DATA

 

This is the code:

 

data WORK.WANT; set ORACLE.HAVE;

WHERE (FACILITY in("FACILITY 1", "FACILITY 2", "FACILITY 3", "ETC"))

AND (ER_ADMIT_DATETIME>='20SEP2017:22:00:00'dt and ER_ADMIT_DATETIME<'22SEP2017:01:00:00'dt)

AND ((UPCASE(PATIENT_POSTAL_CODE) contains "T1T1T1") or (UPCASE(PATIENT_POSTAL_CODE) contains "T1T 1T1"));

run;

 

Any ideas what is causing it? It is accessing an Oracle database, if that matters. 


Accepted Solutions
Solution
‎10-11-2017 11:32 AM
Occasional Contributor
Posts: 8

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to Jordan_Epi

Looks like it is something about the specific data set being referenced. Any data step referring to this table results in the error. Don't know what is causing it yet. 

View solution in original post


All Replies
Respected Advisor
Posts: 2,516

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to Jordan_Epi

This can't be the actual code. HAVE is not an Oracle database. And your code doesn't reference ARTSSN.ATD_ALL_SITES_LAST30DAYS.DATA.

 

Show us the actual code used.

--
Paige Miller
Occasional Contributor
Posts: 8

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to PaigeMiller

Edited the file name in the error to match the data source name.

 

It is the code used, with facility names removed. Otherwise it is identical. 

Respected Advisor
Posts: 2,516

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to Jordan_Epi

Are you doing this in PROC SQL to work with Oracle? Or did you actually run a data step?

 

Really, the more details you can give us, the quicker you will get and answer, and the better the answer will be.

--
Paige Miller
Occasional Contributor
Posts: 8

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to PaigeMiller
A data step. I could switch it over to PROC SQL though.
Frequent Contributor
Posts: 110

Re: Help with "ERROR: Invalid sequence of commands"

[ Edited ]
Posted in reply to Jordan_Epi

I think this is your problem:

 

From your script

WHERE (FACILITY in ("FACILITY 1", "FACILITY 2", "FACILITY 3", "ETC"))

AND (ER_ADMIT_DATETIME>='20SEP2017:22:00:00'dt and ER_ADMIT_DATETIME<'22SEP2017:01:00:00'dt)

AND ((UPCASE(PATIENT_POSTAL_CODE) contains "T1T1T1") or (UPCASE(PATIENT_POSTAL_CODE) contains "T1T 1T1"));

 

You abruptly closed your long where statement.

 

Try this one.....

 

WHERE (
FACILITY in        ("FACILITY 1", "FACILITY 2", "FACILITY 3", "ETC") 

AND (ER_ADMIT_DATETIME>='20SEP2017:22:00:00'dt and ER_ADMIT_DATETIME<'22SEP2017:01:00:00'dt)
AND
(
(UPCASE(PATIENT_POSTAL_CODE) contains "T1T1T1")
or
(UPCASE(PATIENT_POSTAL_CODE) contains "T1T 1T1")

)

);

 

Assuming that the filter for date and time is correct.  I also place more spaces for the "in" i noticed there is no space separating "in(" but i think sas will know and understand but to be safe better put space/s.

 

 

 

Occasional Contributor
Posts: 8

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to ShiroAmada

Unfortunately, that is not it. Even with these changes, it still results in the same error. 

Solution
‎10-11-2017 11:32 AM
Occasional Contributor
Posts: 8

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to Jordan_Epi

Looks like it is something about the specific data set being referenced. Any data step referring to this table results in the error. Don't know what is causing it yet. 

SAS Employee
Posts: 1

Re: Help with "ERROR: Invalid sequence of commands"

Posted in reply to Jordan_Epi

This has been happening to me too in SAS 9.4 M4 lately, no WHERE clause at all.  

   PROC SQL;  CREATE TABLE X as SELECT * FROM ORALIB.ORAVIEW; QUIT;

but fails in SAS data step:

   DATA X; SET ORALIB.ORAVIEW; RUN;

with ERROR: Invalid sequence of commands for file ...and happens on several views now when they seemed to have worked just fine prior to the previous maintenance release.  

☑ This topic is solved.

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

Discussion stats
  • 8 replies
  • 349 views
  • 0 likes
  • 4 in conversation