BookmarkSubscribeRSS Feed
summerkk
Calcite | Level 5

Hi, in my program, I am getting warning messages when I would rather have them show up as an error message. Also, I want a warning message for a certain variable to remain as a warning, and everything else to be changed from warning to error. For example, I want all warning messages containing the variable "APPLE" to remain as a warning message, and all other warning messages with other variables to be changed to error.

I was thinking I want to write something like

If variable name contains APPLE then DKROCOND=WARNING; else DKROCOND=ERROR 

Would this work? I am not sure how to put that into SAS language..Thanks for the help!!

5 REPLIES 5
ballardw
Super User

DKROCOND is a system option and is not conditional and cannot be set for specific variables.

Where are you encountering the warnings and why is an error message preferable? Do you want to halt a process for a certain condition not involving variable "Apple"?

summerkk
Calcite | Level 5

Thanks for the response. So are you saying it will be impossible to overwrite the warnings? I do not want to halt the process involving "Apple", because it is the process that runs through all the other variables. The warning involving "apple" is not important, but the warnings regarding the other variables are, and I would like it to show up as an error instead of a warning.

ballardw
Super User

You do need to say what you are doing when these messages are generated. In some cases and Error will halt the procedure/process.

summerkk
Calcite | Level 5

I am running a data cut program, and the multiple variables that begin with "APPLE" (just an example word I chose) are actually the headings in data set, so I don't really care if the warning comes up as it has never been referenced. I get other warnings about other variables not being referenced, or something not resolved, and I would like those to show up as errors instead of warnings. The errors don't stop the program from running, it just shows up as errors in the output text file created. Therefore, I was wondering if I could somehow change the warnings for all the variables except "APPLE" to error so I can get a better idea of what is going on when I go through the output text file. Hope this wasn't too confusing. Thanks!

ballardw
Super User

For what you are attempting it will depend on what error you really are worried about. The "Not referenced" usually means you have a statement such as DROP KEEP or LABEL where your code is using a variable that is not in the actual data. You can test for the existence of those variables BEFORE the data step code you are running that attempts to reference them and write the specific messages of Variable X doesn't exist in dataset Y.

Example of something "not resolved" would be helpful.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1206 views
  • 0 likes
  • 2 in conversation