BookmarkSubscribeRSS Feed
Fan
Calcite | Level 5 Fan
Calcite | Level 5

I found I cannot post my SAS blogs, in my account, I don't have the options, it is interesting.

I found I can only post questions.

 

%let path = /sas/shared_data/credit_loss_models/MIP_MIS/xx60692/love_heart;;

%let ylabel = Love You To Death;

%let xlabel = Love You To Death;

%let entrylabel = Love You To Death;

%let namelabel = Love You To Death;

%let footnotes = Guaranteed Period: Ten Thousand Years!;

data heart_data1;

do x=-2 to 2 by .05;

y=sqrt(1-(abs(x)-1)**2);

output;

end;

do x=2 to -2 by -.05;

y=arcos(1-abs(x))-3.14;

output;

end;

run;

data heart_data;

set heart_data1;

if y=. then y=0;

if round(x*100)=0 then y=y+.2;

x1=x+0.5;

y1=y;

run;

 

 

data anno_arrow;

x2=-2; y2=-2.5; output;

x2=-.75; y2=-1.25; output;

x2=1; y2=.5; output;

x2=1.75; y2=1.25; output;

run;

data for_heart_data;

retain x y x1 y1 x2 y2;

set heart_data;

y2=0;

if -1.97>x>-2.03 then x2=-2;

if -0.72>x>-0.78 then x2=-0.75;

if -0.49>x>-0.51 then x2=-0.5;

if 0.74>x>0.75 then x2=0.75;

if 1.03>x1>0.97 then x2=1;

if 1.53>x1>1.49 then x3=1.5;

if 1.78>x>1.72 then x3=1.75;

if x2=-2 then y2=-2.5;

if x2=-0.75 then y2=-1.25;

if x2=-0.5 then y2=-1;

if x2=0.75 then y2=0.25;

if x2=1 then y2=.5;

if x3=1.5 then y3=1;

if x3=1.75 then y3=1.25;

if y2=0 then y2=.;

if 0.26<x1<1.24 and y1>0 then y1=.;

if (x1<-0.74 and y>=0) or (x1<0.24 and y<0) then y1=.;

if -0.51 <x2 then y2=.;

if x3< 1.49 then y3=.;

run;

proc sort data=for_heart_data(keep=x3 y3) out=x3y3; by y3; run;

data for_heart;

set for_heart_data(drop=x3 y3); set x3y3;

run;

ods _all_ close; options number nodate;

goptions reset=all device=png gsfname=graphout xpixels=1000 ypixels=400;

ods graphics on/reset imagename="&namelabel." imagefmt=png width=20in height=15in scale=off border=off;

ods listing gpath="&path."; ods path reset;

ODS path (PREPEND) a.TEMPLAT(update);

proc template;

define statgraph a.class; begingraph;

discreteattrvar attrvar=classfill var=fore_sce attrmap='colors';

legendItem type=Line name="x" /lineattrs=(color=red pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Heart1";

legendItem type=Line name="x1"/lineattrs=(color=red pattern=Solid THICKNESS=8) labelattrs=(size=22pt) label="Heart2";

legendItem type=Line name="x2"/lineattrs=(color=grey pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Arrow1";

legendItem type=Line name="x3"/lineattrs=(color=grey pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Arrow2";

layout lattice/border=FALSE BORDERATTRS=(color=white) columns=1 rows=1

COLUMNGUTTER=2cm ROWGUTTER=2cm AUTOALIGN=(TOPRIGHT BOTTOMLEFT) SKIPEMPTYCELLS=TRUE;

cell; cellheader;

entry "&entrylabel."/border=FALSE BORDERATTRS=(color=white) textattrs=(size=50pt weight=bold color=red);

endcellheader;

layout overlay /border=false WALLCOLOR=white WALLDISPLAY=(FILL)

xaxisopts=(display=(label tickvalues) linearopts=(origin=0 THRESHOLDMIN=1 THRESHOLDMAX=1)

label="&xlabel." griddisplay=off labelattrs=(weight=bold size=40pt color=biyg)

tickvalueattrs=(weight=bold size=22pt color=white)

discreteopts=(tickdisplaylist=("-2" "-1.5" "-1" "-0.5" "0" "0.5" "1" "1.5" "2")

tickvaluelist=("-2" "-1.5" "-1" "-0.5" "0" "0.5" "1" "1.5" "2")

 TICKVALUEFITPOLICY=ROTATEALWAYS TICKVALUEROTATION=VERTICAL))

 

yaxisopts=(display=(label tickvalues) label="&ylabel."

labelattrs=(weight=bold size=22pt color=white) griddisplay=off

tickvalueattrs=(weight=bold size=40pt color=white)

linearopts=(integer=FALSE origin=-3 viewmin=-3 tickvalueformat=9.1

tickvaluelist=(-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5) TICKVALUEPRIORITY=TRUE)

gridattrs=(pattern=dash THICKNESS=2 color=white));

seriesplot x=x y=y /BREAK=TRUE LEGENDLABEL="Heart1" PRIMARY=TRUE lineattrs=(color=red pattern=solid THICKNESS=8);

seriesplot x=x1 y=y1/BREAK=TRUE LEGENDLABEL="Heart2" PRIMARY=TRUE lineattrs=(color=red pattern=MediumDash THICKNESS=8);

seriesplot x=x2 y=y2/BREAK=TRUE LEGENDLABEL="Arrow1" PRIMARY=TRUE lineattrs=(color=grey pattern=solid THICKNESS=20);

seriesplot x=x3 y=y3/BREAK=TRUE LEGENDLABEL="Arrow2" PRIMARY=TRUE lineattrs=(color=grey pattern=solid THICKNESS=20)

ARROWHEADPOSITION=END ARROWHEADSCALE=20 ARROWHEADSHAPE=BARBED;

referenceline y=0/ curvelabel=" " curvelabelattrs=(size=22pt weight=bold color=white)

clip=true curvelabelposition=min lineattrs=(pattern=dash THICKNESS=2 color=white);

endlayout;

endcell;

endlayout;

entryfootnote halign=center TEXTATTRS=(size=35pt weight=bold color=green) "&footnotes.";

layout globallegend/border=false type=COLUMN weights=uniform;

discretelegend "Heart1" "Heart2" "Arrow"/border=false across=1 down=1 autoalign=(CENTER) ORDER=COLUMNMAJOR;

endlayout; endgraph; end; run;

proc sgrender data=for_heart template=a.class; Run;

ods graphics off;

ods listing;

%let path = /sas/shared_data/credit_loss_models/MIP_MIS/xx60692/love_heart;;

%let ylabel     = Love You To Death;
%let xlabel     = Love You To Death;
%let entrylabel = Love You To Death;
%let namelabel  = Love You To Death;
%let footnotes  = Guaranteed Period: Ten Thousand Years!;

data heart_data1;
do x=-2 to 2 by .05;
 y=sqrt(1-(abs(x)-1)**2);
 output;
 end;
do x=2 to -2 by -.05;
 y=arcos(1-abs(x))-3.14;
 output;
 end;
run;

data heart_data; 
set  heart_data1;
if y=. then y=0;
if round(x*100)=0 then y=y+.2;
x1=x+0.5;
y1=y;
run;


data anno_arrow;
x2=-2;   y2=-2.5;  output;
x2=-.75; y2=-1.25; output;
x2=1;    y2=.5;    output;
x2=1.75; y2=1.25;  output;
run;

data for_heart_data;
retain x y x1 y1 x2 y2;
set   heart_data;
y2=0;
if -1.97>x>-2.03  then x2=-2; 
if -0.72>x>-0.78  then x2=-0.75; 
if -0.49>x>-0.51  then x2=-0.5;
if 0.74>x>0.75    then x2=0.75;
if 1.03>x1>0.97   then x2=1; 
if 1.53>x1>1.49   then x3=1.5; 
if 1.78>x>1.72    then x3=1.75; 

if x2=-2    then y2=-2.5; 
if x2=-0.75 then y2=-1.25; 
if x2=-0.5  then y2=-1;
if x2=0.75  then y2=0.25;
if x2=1     then y2=.5; 
if x3=1.5   then y3=1; 
if x3=1.75  then y3=1.25; 

if y2=0     then y2=.;
if 0.26<x1<1.24  and y1>0                   then y1=.;
if (x1<-0.74 and y>=0) or (x1<0.24 and y<0) then y1=.;
if -0.51 <x2                                then y2=.;
if        x3< 1.49                          then y3=.;
run;

proc sort data=for_heart_data(keep=x3 y3) out=x3y3; by y3; run;

data for_heart;
set for_heart_data(drop=x3 y3); set x3y3;
run;

ods _all_ close; options number nodate;
goptions reset=all device=png gsfname=graphout xpixels=1000 ypixels=400;
ods graphics on/reset imagename="&namelabel." imagefmt=png width=20in height=15in scale=off border=off;
ods listing gpath="&path.";   ods path reset;  
ODS path (PREPEND) a.TEMPLAT(update);

proc template;
define statgraph a.class;    begingraph;   
discreteattrvar attrvar=classfill var=fore_sce attrmap='colors';
legendItem type=Line name="x" /lineattrs=(color=red  pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Heart1"; 
legendItem type=Line name="x1"/lineattrs=(color=red  pattern=Solid THICKNESS=8) labelattrs=(size=22pt) label="Heart2"; 
legendItem type=Line name="x2"/lineattrs=(color=grey pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Arrow1";
legendItem type=Line name="x3"/lineattrs=(color=grey pattern=solid THICKNESS=8) labelattrs=(size=22pt) label="Arrow2";

layout lattice/border=FALSE BORDERATTRS=(color=white) columns=1 rows=1 
  COLUMNGUTTER=2cm ROWGUTTER=2cm AUTOALIGN=(TOPRIGHT BOTTOMLEFT) SKIPEMPTYCELLS=TRUE;

cell; cellheader;    
entry "&entrylabel."/border=FALSE BORDERATTRS=(color=white) textattrs=(size=50pt weight=bold color=red);
endcellheader;

layout overlay /border=false WALLCOLOR=white WALLDISPLAY=(FILL) 
xaxisopts=(display=(label tickvalues) linearopts=(origin=0 THRESHOLDMIN=1 THRESHOLDMAX=1)
   label="&xlabel." griddisplay=off labelattrs=(weight=bold size=40pt color=biyg) 
   tickvalueattrs=(weight=bold size=22pt color=white)
   discreteopts=(tickdisplaylist=("-2" "-1.5" "-1" "-0.5" "0" "0.5" "1" "1.5" "2")
   tickvaluelist=("-2" "-1.5" "-1" "-0.5" "0" "0.5" "1" "1.5" "2") 
   TICKVALUEFITPOLICY=ROTATEALWAYS TICKVALUEROTATION=VERTICAL))

yaxisopts=(display=(label tickvalues) label="&ylabel." 
   labelattrs=(weight=bold size=22pt color=white) griddisplay=off 
   tickvalueattrs=(weight=bold size=40pt color=white) 
   linearopts=(integer=FALSE origin=-3 viewmin=-3 tickvalueformat=9.1 
   tickvaluelist=(-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5) TICKVALUEPRIORITY=TRUE) 
   gridattrs=(pattern=dash THICKNESS=2 color=white));

seriesplot x=x  y=y /BREAK=TRUE LEGENDLABEL="Heart1" PRIMARY=TRUE lineattrs=(color=red  pattern=solid  THICKNESS=8); 
seriesplot x=x1 y=y1/BREAK=TRUE LEGENDLABEL="Heart2" PRIMARY=TRUE lineattrs=(color=red  pattern=MediumDash THICKNESS=8); 
seriesplot x=x2 y=y2/BREAK=TRUE LEGENDLABEL="Arrow1" PRIMARY=TRUE lineattrs=(color=grey pattern=solid THICKNESS=20); 
seriesplot x=x3 y=y3/BREAK=TRUE LEGENDLABEL="Arrow2" PRIMARY=TRUE lineattrs=(color=grey pattern=solid THICKNESS=20) 
                     ARROWHEADPOSITION=END ARROWHEADSCALE=20 ARROWHEADSHAPE=BARBED;

referenceline y=0/ curvelabel=" " curvelabelattrs=(size=22pt weight=bold color=white) 
  clip=true curvelabelposition=min lineattrs=(pattern=dash THICKNESS=2 color=white);

endlayout; 
endcell;

endlayout;  
entryfootnote halign=center  TEXTATTRS=(size=35pt weight=bold color=green) "&footnotes."; 

layout globallegend/border=false type=COLUMN weights=uniform;
discretelegend "Heart1" "Heart2" "Arrow"/border=false across=1 down=1 autoalign=(CENTER) ORDER=COLUMNMAJOR;
endlayout;  endgraph; end; run;

proc sgrender data=for_heart template=a.class;  Run; 
ods graphics off;  
ods listing;

Love You To Death.png

 

1 REPLY 1
ChrisHemedinger
Community Manager

Hi @Fan, I added you to the "author" role, so you can now create a library article with your example, if you want.  Here are the instructions.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

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
  • 1 reply
  • 544 views
  • 1 like
  • 2 in conversation