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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 5586 views
  • 6 likes
  • 4 in conversation