BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

Use a DATA step to set your exit code.

*************************check from here******************************;
data _null_;
  status = 0;
  IF &TOPRC02=&TDETAIL=&TODETAIL=&TOBILLER THEN status=20 ;
  else IF &TOPRC03=&TDETAIL=&TODETAIL=&TOBILLER THEN status=30;
  else IF &TOPRC04=&TDETAIL=&TODETAIL=&TOBILLER THEN status=40;
  else IF &TOPRC05=&TDETAIL=&TODETAIL=&TOBILLER THEN status=50;
  else IF &TOPRC06=&TDETAIL=&TODETAIL=&TOBILLER THEN status=60;
  else IF &TOPRC07=&TDETAIL=&TODETAIL=&TOBILLER THEN status=70;
  else IF &TOPRC08=&TDETAIL=&TODETAIL=&TOBILLER THEN status=80;
  if status then abort return status ;
run;
sayanapex06
Obsidian | Level 7
Thanks...

TBH, I coded the exactly same thing... And coincidently.. It happens to
match yours..

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Tom
Super User Tom
Super User

If you want to get the SUM() of a value and use in a later data step then perhaps you want something like this:

proc summary nway data=have ;
   var MYVAR ;
   output out=sum_myvar sum=sum_myvar ;
run;

data want ;
  if _n_=1 then set sum_myvar ;
  set have ;
  if myvar > sum_myvar/2 then put 'This value accounts for more than half of the total' (_all_) (=);
run;
Astounding
PROC Star

While you already have a post that identifies the cause of the problem, you would be well advised to combine all of this code into a much simpler form:

 

proc sql;

select sum(QDW_USD_AMT) into : check from TDTL;

quit;

 

This creates the macro variable directly (but doesn't give you an output data set and doesn't perform the renaming piece).

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 18 replies
  • 2099 views
  • 1 like
  • 5 in conversation