11-28-2017 08:56 AM
I have not ever used SAS programming (my programming experience includes ladder logic and some BASIC), however, my girlfriend is taking some Biostatistics courses, and uses the program daily. I got the idea of proposing using a graph output from the SAS program, as it would completely be a huge surprise to her. The problem is... I have absolutely no idea of how to go about writing a program that would display that, much less if it's even possible with this program? I'm really hoping that it would be possible, as this would be something I know she would find incredible that I found a way to do it!
So, short version of my question - is it possible to have the SAS program display that message somehow? If yes, where would be a good place for me to go to start learning how to make it happen?
Thank you for your time!
12-09-2017 03:42 PM - last edited on 01-22-2018 01:50 PM by ChrisHemedinger
Alright, so I now have the program and image set to what I had had in mind from the start! 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 ). 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"
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!
Editor's note: some readers have been curious about the final product of the program. While not an exact replica of the proposal image that this program creates, we've created a generic version of the output that should give you a pretty good idea of how it comes across. Imagine clicking the little "running man" icon and then seeing this pop up!
11-28-2017 09:06 AM
Errm, you get the prize for weirdest question on a programming forum...ever. Yes you can display messages in numerous ways depending on what software from SAS you use, Enterprise Guide can have promts/messages, base sas has the %window or window commands:
For example. You could play some music:
Maybe even plot out a graph so it looks like a hand and ring in a box
However they all take a fair bit of knowledge of the software. Hope that helps.
11-28-2017 09:17 AM
Hahah! I'm okay with that. I know it's a weird thing to ask and want to do. But that's what's going to make it special.
Thanks for the information, I appreciate it.
11-28-2017 09:06 AM
If you haven't already done so, search in this community for subjects including "Fun with SAS ODS Graphics"; you might get some hints. If not sufficient, try to contact the author.
11-28-2017 10:56 AM
You can pretty much draw anything in SAS graphics and/or make it animated...so, I think you first should design what you want to do and then ask specific questions. Start by looking at GTL and/or SGPLOT.
You can get the free version of SAS by searching SAS UE and that will support those types of features....let us know how it goes and if she says yes
11-28-2017 11:02 AM
Following up on @Reeza and others, here is an example of drawing and animating a shape. https://blogs.sas.com/content/graphicallyspeaking/2017/10/19/fun-ods-graphics-drawing-rotating-impos...
I found the geometry harder than the programming. YMMV.
11-28-2017 11:46 AM
Ok...here's two starting pointers that you can try. You can style the text and make it slower or have all the words appear once and can probably add images, ie ring/flowers if desired to the back ground.....like I said, you need to design it.
Here's just the words appearing as a gif. I would suggest saying you have a friend programming in SAS who needs some help with a program. And you can pre-compile it and run it as a macro otherwise as soon as she see's the code the game is up...assuming it's a surprise.
data proposal; input order words $ x y; cards; 1 Will 100 100 2 You 100 100 3 Marry 100 100 4 Me? 100 100 ;;;; options papersize=('5 in', '3 in') printerpath=gif animation=start animduration=1 animloop=no noanimoverlay nonumber nodate; ods printer file='C:\_localdata\temp\demo1.gif'; ods graphics / width=5in height=3in imagefmt=GIF; /* Generate the graphs by year and quarter */ proc sgplot data=proposal; by order; text x=x y=y text=words; xaxis values=(0 to 200 by 50) display=none; yaxis values=(0 to 200 by 50) display=none; run; options printerpath=gif animation=stop; ods printer close;
data proposal2; input order words $ x y; cards; 1 Will 100 200 2 You 100 150 3 Marry 100 50 4 Me? 100 0 ;;;; options papersize=('5 in', '3 in') printerpath=gif animation=start animduration=1 animloop=no noanimoverlay nonumber nodate; ods printer file='C:\_localdata\temp\demo2.gif'; ods graphics / width=5in height=3in imagefmt=GIF; /* Generate the graphs by year and quarter */ proc sgplot data=proposal2; by order; text x=x y=y text=words; xaxis values=(0 to 200 by 50) display=none; yaxis values=(0 to 200 by 50) display=none; run; options printerpath=gif animation=stop; ods printer close;
11-28-2017 12:13 PM
11-28-2017 02:48 PM
11-28-2017 02:58 PM - edited 11-28-2017 03:20 PM
Just have to say -- I love this discussion!
You might also augment with programs from here, furnished by our resident statistician (and love doctor) @Rick_SAS.
A parametric view of love (adapt for your own message - note that this particular one requires SAS/IML Studio -- probably not an option for you. But similar programs are out there.)
12-01-2017 06:34 PM
So I ran both of the programs that you had given as a sample to see what they would look like. Neither of them will actually display as a .gif within the SAS program window. It shows each of the 4 cards individually, from top to bottom, instead of as a .gif. I also get the following error code:
11-29-2017 10:04 AM
I am awe-struck by all the helpful information and support this has received in just a few hours! What a great community!
I am hoping to have some time to get started on this tonight, so I'll see how my first time goes. Haha.
Thank you everyone again, very kind of all of you!
Need further help from the community? Please ask a new question.