BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jordan_Epi
Fluorite | Level 6

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
Jordan_Epi
Fluorite | Level 6

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

8 REPLIES 8
PaigeMiller
Diamond | Level 26

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
Jordan_Epi
Fluorite | Level 6

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. 

PaigeMiller
Diamond | Level 26

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
Jordan_Epi
Fluorite | Level 6
A data step. I could switch it over to PROC SQL though.
ShiroAmada
Lapis Lazuli | Level 10

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.

 

 

 

Jordan_Epi
Fluorite | Level 6

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

Jordan_Epi
Fluorite | Level 6

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. 

doogie64
SAS Employee

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.  

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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