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

I'm trying to do a simple LEFT JOIN but when trying to process, SAS tells me the file does not exist. Problem being, of course, the file does exist. Any help?

Here's an example:
PROC SQL;
CREATE TABLE WORK.FINAL_DATA AS
SELECT t1.CAT1,
t1.CAT2,
t2.CAT3,
t1.CAT4

FROM WORK.PRELIM_DATA1 t1
LEFT JOIN WORK.PRELIM_DATA2 t2 ON (t1.CAT1 = t2.CAT1)
WHERE (t1.TIMECAT1 <= t2.TIMECAT1) AND (t1.TIMECAT1 >= t2.TIMECAT2);
QUIT;

So for me it breaks after the WHERE line, telling me that WORK.PRELIM_DATA2.DATA does not exist. Problem is, the table clearly does exist, I can have it open and viewing at the same time I'm trying to execute this query.

Interestingly, this same data also caused SAS to lock up when trying to add it via a Join Tables in the Query Wizard, thus why I'm doing it manually, but something else appears to be causing the issue here.

SAS EG 7.1
1 ACCEPTED SOLUTION
6 REPLIES 6
Reeza
Super User

Can you post the output from a proc contents?

 

proc datasets lib=work;
run;
Goose306
Fluorite | Level 6
I do not show the dataset listed for PRELIM_DATA2 when I run this. Interesting, since it shows on my EG window and the data is viewable. How is this corrected?
ChrisHemedinger
Community Manager

With the data open in the data grid, click on the Properties icon (far right side of the toolbar in the data viewer).  Use that to verify the data you're looking at is where you think it is.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Reeza
Super User

Use the following code to see the library and dataset name. Most likely it's in a library that's not WORK.  

 

proc sql;
select libname, memname, 
from sashelp.vtable
where upper(memname)='PRELIM_DATA2';
quit;
Goose306
Fluorite | Level 6

Thanks - this one tipped me off. I was hovering over the table in the EG space and noticed it was on a different server - my SAS has two identical servers, and this one was located on the WORK directory on the other server. Rookie mistake. Man Embarassed

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
  • 6 replies
  • 4257 views
  • 6 likes
  • 4 in conversation