BookmarkSubscribeRSS Feed
AI_Vonnegut
Calcite | Level 5

When SAS Enterprise Guide 7.15 is assigned a library that does not exist, it simply produces a note:

NOTE: Library CALCOUT does not exist.

This is a rather unhelpful default since the message gets buried in the log. I've searched a lot trying to find a way to force an Error (or at least a Warning) when a library does not exist, but I can't find anything. It also seems like some versions of SAS automatically generate an error (SAS Studio?), but that's not the case with EG. Does anyone know of a way to change this?

 

3 REPLIES 3
brzcol
SAS Employee

Depending on your version of SAS, one idea is to write in a little bit of macro code to create an error message.

 

libname xyz "AnIncorrectPath";
 %if &syslibrc ne 0 %then %do;
      %put ERROR:The library you tried to create does not exist;
 %end;

data example;
set sashelp.class;
run;

 

log.PNG

 

Documentation for %if %then : https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=mcrolref&docsetTarget=... 

Documentation for the syslibrc automatic macro variable: https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=mcrolref&docsetTarget=... 

 

Even though you are manually creating the error and not EG automatically, hope this helps some. If this isn't what you were going for, feel free to disregard.

AI_Vonnegut
Calcite | Level 5

Thanks. I am familiar with %IF %THEN statements and have used them for custom messages in the past - but at least in EG, they can't be used in open code and must be inside a %MACRO statement. While I can do this, a macro won't be a clean solution (I would have to make a global macro to apply across all programs within EG). I really thought there would be an option or a setting within SAS that would give a warning/error when a library doesn't exist. Rather surprising that it's not possible to do this (if indeed that's the case).

Tom
Super User Tom
Super User

Note that whether %IF %THEN %DO works in open code or not has nothing to do with whether you are using Enterprise Guide or not.  It just depends on what version of SAS your Enterprise Guide session is using to run the SAS code you ask it to run for you.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 726 views
  • 0 likes
  • 3 in conversation