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

I'm running some code in SAS Enterprise Miner 15.1 from a SAS blog:

proc sgscatter data=CARDATA_TRAIN;
  label make='Make' weight='Weight';
  label horse_power='Horse Power' mpg='mpg';
  matrix make weight horse_power  mpg;
  run;

I'm getting the error

ERROR: File WORK.CARDATATRAIN.DATA does not exist.

The error is correct as the SAS table is called CARDATA_TRAIN, but  SAS has prefixed the table name with "WORK" and suffixed with "DATA". Which is why I'm getting the error!

Why is SAS doing this? How do I over come this? Any advice would be appreciated. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If you do not explicitly provide a library name for a data set then SAS assumes and treats the name as belonging to the WORK library. If you data set is in a different library you must provide the name.

There are a few things that will use other sorts of files that SAS uses such as catalogs or views but if you don't provide that information, where appropriate, the the file is assumed to be a SAS data set. Since you use the name on a DATA= option then SAS tells you that an expected data set was not found. Don't worry about the .DATA, it is only used explicitly in a very small subset of SAS syntax.

 

The "no observations" is a direct result of the source data set not existing. When you read nothing (the missing dataset) then there are "no observations". Single errors can cause multiple error messages depending on the specific issue.

 

So, where is the code that created your Cardata_train data set?

View solution in original post

5 REPLIES 5
azmol
Calcite | Level 5
I forgot to mention it also comes with the error:
ERROR: No data set open to look up variables.
The error log out put is:
24491 %let SYSCC=0;
24492 %let SYsrc=0;
24493 %let EMEXCEPTIONSTRING=;
24494 %let SYSMSG=;
24495 proc sgscatter data=cardata_train;
ERROR: File WORK.CARDATA_TRAIN.DATA does not exist.
24496 label make='Make' length='Length';
24497 label weight='Weight' mpg='mpg';
24498 matrix make length weight mpg;
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
24499 run;
ballardw
Super User

If you do not explicitly provide a library name for a data set then SAS assumes and treats the name as belonging to the WORK library. If you data set is in a different library you must provide the name.

There are a few things that will use other sorts of files that SAS uses such as catalogs or views but if you don't provide that information, where appropriate, the the file is assumed to be a SAS data set. Since you use the name on a DATA= option then SAS tells you that an expected data set was not found. Don't worry about the .DATA, it is only used explicitly in a very small subset of SAS syntax.

 

The "no observations" is a direct result of the source data set not existing. When you read nothing (the missing dataset) then there are "no observations". Single errors can cause multiple error messages depending on the specific issue.

 

So, where is the code that created your Cardata_train data set?

azmol
Calcite | Level 5
@ballardw thanks, I think it worked. There is a new error, it's trying to write to the Program Files directory, which it does not have permission to do so:
Cannot write image to C:\Program Files\...
How can I change the output?
ballardw
Super User

@azmol wrote:
@ballardw thanks, I think it worked. There is a new error, it's trying to write to the Program Files directory, which it does not have permission to do so:
Cannot write image to C:\Program Files\...
How can I change the output?

You should show the code with messages from the log.

 

Without complete details the most likely is that you have some sort of server that is executing your code and the path you are attempting to send the output to is actually on that server, where you wouldn't have permission, causing the error. In this case you likely have some sort of work space that has been setup where you can create output but that depends on your SAS configuration.

 

Another possibility if not working with a server is that you did not provide a full path for your output. If you use a file name like "myoutput.rtf" (or other extension for other output) then SAS defaults to attempting to write to the "active" folder which is frequently the folder SAS executes from.

Generally it is good habit, with any software, to provide file names starting at a drive (Windows) such as "C:\folder\otherfolder\myoutputfilename.ext", or a mount point in Unix.

 

Many organizations have "locked down" the Program Files directory in windows so you need admin privileges to write any files there and may be the proximate cause of the error. But it isn't a good idea to be sending your output there in the first place.

 

If you are using SAS University Edition or SAS On Demand for Academics there are other issues as well.

azmol
Calcite | Level 5
To change the working directory:
data _null_;
rc=dlgcdir("C:\Users\student\Documents\Output");
put rc=;
run;

The answer provided by @ballardw works, thanks.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2193 views
  • 0 likes
  • 2 in conversation