BookmarkSubscribeRSS Feed
amsa1996
Fluorite | Level 6

Hi!

 

I have created a dummy variable as my target variable where 0 indicates that the event "payment handled" has not occured, and 1 that is have occured. Furthermore, i want to add a value "2" in my target variable indicating that the event "payment handled" has not occured due to another event called "decleration rejected". This means that the event has to have a value <0 at decleration rejected, and 0 at payment handled. Both events are extracted from the same column named, activity_id. 

 

Can someone help?

 

3 REPLIES 3
amsa1996
Fluorite | Level 6

It has to have a value >0 at decleration rejected** 

Shmuel
Garnet | Level 18

If I understand you correctly than add a line:

sum(activity_id="decleration rejected")  as rejected /* new dummy */

then add a new step:

data tuetravelexpenses_cases;
 set tuetravelexpenses_cases;
       if rejected > 0 then target_variable=2;
      *drop rejected;
run;

 

amsa1996
Fluorite | Level 6

Almost!

 

The value "2" requires that "payment handled" is 0, and "declaration rejected" > 0, and not only that "declaration rejected" > 0. 

 

But i managed that by adding "and". Thanks for the help!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1078 views
  • 1 like
  • 2 in conversation