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
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
You can use the cumulative option on proc freq to reduce the number of steps
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;
Thanks. Rezza.
I don't realize there is such an useful option in proc freq. Good to know.
Xia Keshan
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.
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.