Data visualization with SAS programming

Accepted Solution

Newbie here! Question about a proposal using SAS! :)

Reply
Contributor
Posts: 28

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to Vince_SAS

Yep, just tried that, and got everything how I want it. Smiley Very Happy

SAS Super FREQ
Posts: 442

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

I am absolutely fine with you using it!  I have been out on a hike so I missed most of the dialogue today.

 

Here is a blog I wrote  using basically the same code.  I "pause" it by repeating some of the frames.  I can help you with that if it is not clear.

https://blogs.sas.com/content/graphicallyspeaking/2017/12/06/fun-ods-graphics-animating-text/

 

Best wishes!

Highlighted
Solution
a month ago
Contributor
Posts: 28

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

 

Alright, so I now have the program and image set to what I had had in mind from the start! Smiley Very Happy Hooray!

 

First, I would like to thank each and every person that was involved with this, and has helped me along the way. I know I would not have been able to get this done if it weren't for everyone's help. This is a truly incredible community, with clearly great people in it, and I'm so grateful to have come up with the idea and found this forum! A truly heart-felt thank you to everyone, I greatly appreciate it.

 

Second, I have one question that came to mind - within the forum, am I able to select more than one post as "Accept as solution"? If I can only select one post as the "solution", then I think the biggest credit needs to go to @WarrenKuhfeld , as he created almost exactly what I had pictured in mind. Thank you again, Warren! Also, I would like to thank @Reeza for help with the pathing issues I ran into with SAS UE.

 

Lastly, it is still going to be a few weeks before the big day actually happens, as I have to wait on her ring to be completed. We are having it custom-made, we picked out the design together, and tweaked some things about it (and I had them add "Leo" diamonds to it Smiley Wink ). She knows that it's still in the process, but she doesn't know that I'm going to go get it when it's complete and that will be the day I surprise her with everything. So, I will absolutely keep everyone posted as to how things go! 

 

Now, here is the image that I used for the final program, I decided to take @Vince_SAS advice, and have everything obfuscated, even the name of the final .gif output, and the image name. The image name I use within the program is "image1jpg"

image1jpg.jpg

 

 

 

 

 

 

 

 

Here is the final SAS code that will be used, I love how this works using the hex to hide the message!

 

ods _all_ close;

title;
footnote;

data work.words;
input line $hex40.;
datalines;
 436872697374696E612C206D79206C6F76652C20
 57696C6C20202020202020202020202020202020
 596F752020202020202020202020202020202020
 4D61727279202020202020202020202020202020
 4D653F2020202020202020202020202020202020
;
run;

data work.message(drop=i line inc max);
length draw $ 20;
set words;
x = 5; inc = 2.0; max = 11;
do i = 1 to length(line);
  order + 1; y = max;
  do j = 1 to _n_ - 1;
    set work.words(rename=(line=draw)) point=j; y + -inc; k + 1; output;
  end;
  draw = substr(line, 1, i);
  y = max - _n_ * inc;
  k + 1; output;
end;
call symputx('MAXORDER', order);
run;

data _null_;
set work.message(where=(order=&maxorder)) nobs=n1;
call symputx('MINO', k);
call symputx('MAXO', n1);
stop;
run;   

data work.message(drop=j k); /* Pause */
set work.message end=eof;
output;
if eof then do j = 1 to 5;
  do i = &MINO to &MAXO; 
    set work.message point=i; 
    order + j; 
    output; 
  end;
end;
run;

data work.annoImage;
function  = 'image'; 
height    = 100; 
width     = 100; 
drawspace = 'GraphPercent';
image     = '/folders/myfolders/image1jpg.jpg'; 
layer     = 'back';
run;

options papersize=('10 in', '9 in') printerpath=gif animation=start
        animduration=.3 animloop=1 noanimoverlay nonumber nodate nobyline;

ods printer file='/folders/myfolders/sasdemo1.gif';

ods graphics / width=10in height=9in imagefmt=gif;

proc sgplot data=message nowall noborder noautolegend sganno=annoimage;
  by order;
  text    x=x y=y text=draw / textattrs=(size=38 weight=bold color=white style=italic);
  xaxis values=(0 to 10) min=0 max=10 display=none;
  yaxis values=(0 to 10) min=0 max=10 display=none;
run; quit;

options animation=stop byline;

ods printer close;

Now it's just a matter of time until I get the call that her ring is complete! 

 

Once again, thank you everyone for ALL of the support, insight, and help that I've received here! Truly an awe-inspiring experience! Smiley Very Happy

 

-Brandon

SAS Super FREQ
Posts: 442

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Brandon,
I am sure I speak for everyone at SAS Communities, when I saw that we are so glad we could help!  I saw  Chris,  Vince, and Bev this week, and we are all excited about this!
Best wishes!

Warren

SAS Super FREQ
Posts: 322

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

You did a great job of digesting a ton of information and pulling it all together!

 

@ShelleySessoms can look into the possibility of marking multiple posts as solutions.  It that's not possible, then you can create a new post with permalinks to what you consider to be the solutions, and then mark that post as the solution.

 

You've discovered something that many of us take for granted: the SAS development and user community is filled with extraordinary people.

 

I'm glad that I was able to help with this project, and we anxiously await the rest of the story.

 

And the new posting asking for help using the SAS RWI to create your wedding invitations...

 

Vince DelGobbo

SAS R&D

 

 

 

Community Manager
Posts: 608

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to Vince_SAS

What@Vince_SAS said: Lots of amazing people in here! @grandpastyle13: At your convenience, you can post one comment that encapsulates the tips you used and tag the contributors. When you mark that one as the accepted solution, everyone tagged accrues credit.

 

Can't wait till you pop the question!

 

/* rose picture*/
ods graphics/reset=all;
ods graphics/ imagefmt=png;
options device=png;

options nodate nonumber;

*ods graphics/ height=6.5in noborder;
ods pdf gtitle gfootnote
	file="n:\rose_card.pdf"
	 startpage=no ;
title;
ODS USEGOPT ;
%macro makecard(for=@grandpastyle13,from=SAS Community Managers);

	data Roses;
		/* the array below has a list of multipliers that make 
		pretty roses, it is temporary, so will not be saved
		with the data*/
		array klist{11} _temporary_ (4, 5, 6, 1.5, 2.5, 1.333333, 2.33333, .75, 1.25, 1.2, .8333333);

		do flower=1 to 12;
			n = ceil( 11*rand("Uniform") );

			/*pick a random number
			between 1 and 11*/
			k=klist{n}; /*assign k to be the nth multiplier*/

			/* draw the rose r=cos(k * theta) */
			do theta = 0 to 12*constant("pi") by 0.1;
				r = cos(k * theta);      /* generalized rose */
				x = r*cos(theta);        /* convert to Euclidean coords */
				y = r*sin(theta);

				/*move the rose to the right spot*/
				if flower <= 5 then
					do;
						cx=2*flower+1;
						cy=9;
					end;
				else if 6<= flower<=9 then
					do;
						cx=(2*flower-8);
						cy=10.5;
					end;
				else if 10<= flower<=12 then
					do;
						cx=(2*flower-15);
						cy=12;
					end;

				x=x+cx;
				y=y+cy;
				group=flower;
				output;

				/*make the stem*/
				group=-flower;
				x=cx;
				y=cy;
				output;
				x=7;
				y=3;
				output;
			end;
		end;

		/*bow*/
		do theta = constant("pi")*7.5/12 to constant("pi")*28.5/12 by 0.01;
			r = cos(2 * (theta));       /* rose */
			x = r*cos(theta);          /* convert to Euclidean coords */
			y = r*sin(theta);
			group=100;

			if y<abs(x) then
				do;
					x=x+7;
					y=y+3;
					output;
				end;
		end;
	run;

	proc sort data=roses;
		by group;
		title1 "Good luck, @grandpastyle13!" ;
		title2 "(These random polar roses will keep till you propose. ;-)" ;

	proc sgplot data=Roses aspect=1 noautolegend
			noborder nowall;
		styleattrs datacontrastcolors=
			( 
			green green green green
			green green green green
			green green green green
			red  bippk red purple bippk 
			blue purple  bippk red purple  blue red
			crimson 
				) datalinepatterns=(1);
		series x=x y=y /group=group;
		xaxis min=0 max=15 display=none;
		yaxis min=0 max=15 display=none;
		footnote "Best wishes, &from";
		footnote2 " ";
		footnote3 " ";
		footnote4 " ";
		footnote5 " Polar Roses: r = cos(k*theta)";
		footnote6 " Generated with the SAS System 9.4";
	run;
	title;
	footnote;

%mend;

    %makecard(for=@grandpastyle13,from=Your SAS Community Managers);

ods pdf close;

 

 

-
Bev Brown
Visit me on LinkedIn.
Twitter too: @BevBrown
Thank you for using SAS.jpg
SAS Super FREQ
Posts: 442

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

If anyone is interested, I took basically the same code that I provided Brandon, changed the background and the words, and sped up the animation to make this blog:

 

https://blogs.sas.com/content/graphicallyspeaking/2017/12/06/fun-ods-graphics-animating-text/

 

Contributor
Posts: 28

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Good morning everyone! Smiley Very Happy

 

So... I have some news!

 

We are now engaged!!! Smiley Very Happy Smiley Very Happy 

 

I got the call yesterday afternoon at work that her ring was completed (it was finished 3 weeks earlier than expected!), so I went and got it right away. When I got home, I told her I wanted her to see what I'd been working on with SAS.

 

I had her look at the code, and then run it on my computer. I then told her to open up the .gif output within SAS. I was knelt next to her as I was having her do this... She didn't suspect a thing! Smiley Wink

 

When the image loaded up, and the text started writing, her jaw dropped. She was in complete disbelief. She said multiple times that she was completely in shock and couldn't believe I had thought to do it that way. She absolutely loved it! 

 

Everything worked out perfectly, and she was totally floored by the entire thing... Exactly how I wanted it to be! Smiley Very Happy

 

I emailed her the image and code that I used, and also the final .gif output from SAS (one great that about the final output is that is something she and I will have forever now! Smiley Very Happy). She told me "You do know that I have to show this to my professor and tell him you did this... He's not going to believe it!" I told her that of course, I'm fine with that. Smiley Happy

 

I just wanted to say thank you SO VERY MUCH again to everyone that was involved and helped me out. It truly was perfect, and happened just the way I intended it to! Smiley Very Happy

 

Forever grateful,

 

-Brandon

 

Community Manager
Posts: 3,112

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

CONGRATULATIONS @grandpastyle13! This SAS program is definitely one for the books.

Community Manager
Posts: 470

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Congratulations, @grandpastyle13! So happy the community could participate in your big day!

 

SAS Super FREQ
Posts: 322

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

That is such great news, and awesome timing ... right before the holidays!

 

Congratulations!

 

Vince DelGobbo

SAS R&D

SAS Employee
Posts: 12

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Congratulations!! I've been anxiously waiting for this announcement!! So happy for you both!

Julie

Community Manager
Posts: 602

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

I'm SO HAPPY for you @grandpastyle13! I've been watching this thread eagerly awaiting the outcome. It's a SAS fairy tale come to life! Congratulations!!!

SAS Super FREQ
Posts: 442

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Brandon,

Awesome!  Congratulations to you!  Best wishes to the bride!  This is wonderful!
Warren

Super Contributor
Posts: 269

Re: Newbie here! Question about a proposal using SAS! :)

Posted in reply to grandpastyle13

Wow!! Congratulation...

I was eagerly waiting for the result. 

Great news Smiley Happy 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats