BookmarkSubscribeRSS Feed
AmitKB
Fluorite | Level 6

Hi all,

           I have 3 dates  for each customer. An offer Creation date, A contact date ( not all are contacted, and an offer accept date ( customer can accept without being contacted. I want help to create following data shown in table.

  The  "Status Day 0" is the offer creation date.  For each day i need to classify the customers to one of the following statuses:

StatusDescription
1offer accepted after contact
2offer accepted without any contact
3Offer still not accepted but contacted
4offer still not accpted but were not contacted

  I appreciate all your help.

Regards,

Amit

Final table:

CustIDOfferCreationContact_DateAcceptDateStatus
day0
Status
day1
Status
day2
Status
day3
Status
day4
102Jul2012 44444
213Aug2012 15Aug201244222
329Jun2012 02Jul201244422
429Jun2012 26Jul201244444
613Aug201215Aug201215Aug201244111
722Aug201225Aug2012 44433
1 REPLY 1
Reeza
Super User

I would create a long version of my dataset first (something like below, which is untested). And then transpose it, this seems easier because you don't have to know how many days you have ahead of time. Then you can fill in the missing days with the last observation using arrays.

I also haven't worked out the if conditions, but that seems relatively straightforward.

data want;
set have;

end_loop=max(offer_creation, contact_date, acceptdate);

day=0;

do date_ordered=offercreation to end_loop;

*Create if conditions here to assign status to each day;

if date_ordered=offercreation then status=4;

else if ...

;

output;

day+1;

end;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 750 views
  • 0 likes
  • 2 in conversation