BookmarkSubscribeRSS Feed
LauraRK
Quartz | Level 8

Well not as good as polar rose valentines inspired by Rick Wicklin https://communities.sas.com/t5/Graphics-Programming/Challenge-for-SAS-Nerds-Build-a-SAS-Valentine/m-...  

I was short on time given given the pandemic, but if you want something cute:

 mix_valentine.png

outlier_valentine.png

skewed_valentine.png

/* Laura Kapitula's geeky valentines 2021";

/* simulate */
ods graphics/ height=3in;
title height=2 color=black "Valentine, let's mix our distributions.";
data sim;

do i= 1 to 10000;
  p=rand('bernoulli',.5); 
  if p=1 then do;
     person = 'you';
       x=rand('chisq',10)+4;
  end;
  else if p=0 then do;
       person='me ';
	  x= rand('normal',3,4);
  end; 
  output;
end;
run;

proc sgplot data=sim;
  histogram x/ group=person  transparency=.5  ;
    keylegend / location=inside down=3 noborder position=topright fillheight=20 title=" ";
  density x / group=person type=kernel ;
  xaxis display=none;

run;


data sim2;
  do i= 1 to 100;
    x=rand('normal', 100,20);
    if 47<x<155 then output;
  end;
  x=170; label='you'; output;
run;

ods graphics / width=6in height=1.5in;
title height=2 color=black "Valentine, you are a positive outlier.";
proc sgplot data=sim2 noborder;
  hbox x / datalabel=label  fillattrs=(color=pink) lineattrs=(color=red thickness=2) whiskerattrs=(color=red thickness=2) 
outlierattrs=(size=30 symbol=heartfilled color=red  ) medianattrs=(color=red thickness=2) meanattrs=(color=red)
datalabelattrs=(weight=bold color=crimson size=12)  boxwidth=1   ; 
  xaxis display=none;
run;

ods graphics/ height=3in;
title height=2 color=black "Valentine, I love that you are positively skewed.";
data sim3;

do i= 1 to 10000;
      person = 'you';
       x=rand('gamma',2,2);
    output;
end;
run;

proc sgplot data=sim3 noautolegend;
  histogram x/  fillattrs=(color=pink) nooutline   ;
  density x / type=kernel lineattrs=(color=red thickness=2) ;
  xaxis display=none;
run;
2 REPLIES 2
djrisks
Barite | Level 11

Awesome graph Laura! This has really inspired me! 🙂 I really like the let's mix our distribution graph! 

LauraRK
Quartz | Level 8
that is my favorite of these as well. My real favorite is the animated polar roses, but I like these for their simplicity. Lot's of fun with SGPLOT .

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 704 views
  • 7 likes
  • 2 in conversation