BookmarkSubscribeRSS Feed
mich
Calcite | Level 5


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

3 REPLIES 3
Ksharp
Super User
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

Reeza
Super User

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;

Ksharp
Super User

Thanks. Rezza.

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

Xia Keshan

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 892 views
  • 0 likes
  • 3 in conversation