BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Patrick
Opal | Level 21

Hi all,

Is there any SAS option I could change so that a unique index constraint violation leads to an Error instead of a Warning?

data target(index=(name /unique)) Change;
  set sashelp.class;
  output target;
  if _n_=5 then name='Neo' ;
  output Change; 
run;

proc append base=target data=change;
run;

Patrick_0-1668684393281.png

 

In an ideal world SAS would roll-back the insert - but I can understand that I'm not dealing with a database and why that's not possible and it's also not a real issue for my actual use case.

....but I'd really love if SAS would throw an Error and stop further processing instead of me having to check explicitly for a Warning and then issue an abort.

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Given that no one answered assumed that I didn't miss something and there isn't a SAS option/configuration that would allow me to instruct SAS to throw an error instead of a warning.

 

Going to mark my own answer as solution in order to close this track.

View solution in original post

2 REPLIES 2
Patrick
Opal | Level 21

Given that no one answered assumed that I didn't miss something and there isn't a SAS option/configuration that would allow me to instruct SAS to throw an error instead of a warning.

 

Going to mark my own answer as solution in order to close this track.

PeterClemmensen
Tourmaline | Level 20

I browsed The Complete Guide to SAS Indexes by Michael A. Raithel and did not find such an option either. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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