Help using Base SAS procedures

Creating cumulative event rate by month of origination

Reply
Occasional Contributor
Posts: 12

Creating cumulative event rate by month of origination


Hello,

i have a data showing the list of customers targeted for a specific product for the last year, so each customer in a different month and we have many customers in each month. we offer a product in that month and the customer reply in 1, 2, 3 or 4,... months and maybe he will not respond. we want to plot cummulative percentage of response by month of origination

ex:

Date of Origination   Customr name         Month of reply

1/1/2013                Customer 1                January

1/1/2013                Customer 2                 March

1/1/2013                Customer 3                February

1/1/2013                Customer 4                January

1/1/2013                Customer 5                June

...........

the graph should chows that 2/5 of customer respond in January, 3/5 before February, 4/5 before March, 4/5 before April, .....................

Thanks

Michel

Super User
Posts: 9,681

Re: Creating cumulative event rate by month of origination

data x;
input d : mmddyy10. (c m ) (& $20.);
date=input(cats('01',substr(m,1,3),'2013'),date9.);
format date monyy7.;
cards;
1/1/2013                Customer 1                January
1/1/2013                Customer 2                 March
1/1/2013                Customer 3                February
1/1/2013                Customer 4                January
1/1/2013                Customer 5                June
;
run;
proc freq data=x noprint;
tables date /out=y nopercent;
run;
data y; 
 set y;
 cum+count;
run;
proc summary data=y;
var count;
output out=z sum=sum;
run;
data want;
 set y;
 if _n_ eq 1 then set z     ;
 per=divide(cum,sum);
 format per percent8.2;
run;
proc sgplot data=want;
  series x=date y=per /markers;
run;

Xia Keshan

Super User
Posts: 17,829

Re: Creating cumulative event rate by month of origination

You can use the cumulative option on proc freq to reduce the number of steps Smiley Happy

data x;

input d : mmddyy10. (c m ) (& $20.);

date=input(cats('01',substr(m,1,3),'2013'),date9.);

format date monyy7.;

cards;

1/1/2013                Customer 1                January

1/1/2013                Customer 2                 March

1/1/2013                Customer 3                February

1/1/2013                Customer 4                January

1/1/2013                Customer 5                June

;

run;

proc freq data=x noprint;

tables date /out=y nopercent outcum;

format date monyy7.;

run;

proc sgplot data=y;

  series x=date y=cum_pct /markers;

  format date monyy7.;

run;

Super User
Posts: 9,681

Re: Creating cumulative event rate by month of origination

Thanks. Rezza.

I don't realize there is such an useful option in proc freq. Good to know.

Xia Keshan

Ask a Question
Discussion stats
  • 3 replies
  • 189 views
  • 0 likes
  • 3 in conversation