Quartz | Level 8

## Can SAS create the attached the shapes of curvers?

Hi all,

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.

Any suggestions?

Thanks,

Ethan

4 REPLIES 4
SAS Super FREQ

## Re: Can SAS create the attached the shapes of curvers?

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!

Dan

Quartz | Level 8

## Re: Can SAS create the attached the shapes of curvers?

Dan,

Thanks a lot. Very helpful suggestion.

I started developing the attached code that seems accomplish the 1) you mentioned.

But I don't know how to put all together.

Could you offer further helps for 2) and 3)?

Regards,

Ethan

SAS Super FREQ

## Re: Can SAS create the attached the shapes of curvers?

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!

Dan

Quartz | Level 8

## Re: Can SAS create the attached the shapes of curvers?

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.

Ethan

Discussion stats
• 4 replies
• 701 views
• 0 likes
• 2 in conversation