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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1203 views
  • 0 likes
  • 3 in conversation