I found one good graph described customer life value. I wonder if SAS can produce the similar shape of curves.
Sorry I don't have any data.
Here are some thoughts for you using SGPLOT overlays:
1. The "Profit" area can be done using using a BAND plot with a constant lower value (lower=0, for instance)
2. The line curves can be done using SERIES plots. I would use the SMOOTHCONNECT option to keep them smooth
3. The arrows can be drawn using a HIGHLOW plot, using TYPE=BAR and HIGHCAP=FILLEDARROW
Hope this helps!
Using your code, I added some extra data so that you can see how the other two plots can be used.
%let THRESHOLD = 0; data wave; t=0; do x=0 to 6 by .05; y=sin(0.5*x); y2=sin(0.5*x) + 0.5; if t = 20 then do; upper = y2; lower = y; t = 0; end; else do; upper=.; lower=.; t=t+1; end; positive = y; negative = &THRESHOLD; ; output; end; run; ods path(prepend) work.templat(update); proc template; define style mystyle; parent=styles.sasweb; class graphwalls / frameborder=off; class graphbackground / color=white; end; run; ods listing close; ods html style=mystyle path='.' file='newgraph.html'; ods graphics / reset=all border=off width=600px height=400px imagename="cdh2"; proc print data=wave; run; proc sgplot data=wave noautolegend; YAXIS DISPLAY=NONE LABEL = " " ; XAXIS DISPLAY=NONE LABEL = " " ; band x=x lower=&THRESHOLD upper=positive / transparency=0.5; band x=x lower=negative upper=&THRESHOLD / transparency=0.5; series x=x y=y2 / smoothconnect lineattrs=(color=blue thickness=3); highlow x=x high=upper low=lower / type=bar highcap=filledarrow intervalbarwidth=30px; title " "; footnote ""; run; ods html close; ods listing;
Hope this helps!
Thank to Dan for the great progress made so far. Now I understander how to put the 3 things together.
But if I want to make the graph more look like the attached graph from my initial post, my challenge is to figure out on how to create the data to form the curves in order to achieve the desired results since the curves are not symmetric.
I'm really apprecitive of any helps.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.