BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
grandpastyle13
Obsidian | Level 7

Hello,

 

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!

 

-Brandon

1 ACCEPTED SOLUTION

Accepted Solutions
grandpastyle13
Obsidian | Level 7

 

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"

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! 😄

 

-Brandon

 

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!

 

valentine.gif

View solution in original post

79 REPLIES 79
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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:

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206734.htm

For example.  You could play some music:

https://www.pharmasug.org/proceedings/2016/TT/PharmaSUG-2016-TT12.pdf

 

Maybe even plot out a graph so it looks like a hand and ring in a box

https://blogs.sas.com/content/graphicallyspeaking/

 

However they all take a fair bit of knowledge of the software.  Hope that helps.

grandpastyle13
Obsidian | Level 7

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. 🙂

Kurt_Bremser
Super User

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.

grandpastyle13
Obsidian | Level 7

Excellent! Thank you for the information, I appreciate it. 🙂

Reeza
Super User

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 🙂

WarrenKuhfeld
Rhodochrosite | Level 12

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.

 

Reeza
Super User

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;

Option 2:

 


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;

 

grandpastyle13
Obsidian | Level 7
You guys are totally awesome! This is a great starting point. I should be able to figure things out from all of this info. I've got about a month and a half to get it all ready, so it should be fine. And yes, of course it's going to be a surprise. I will keep you posted on her answer, although I'm already sure it's a yes. Thanks so much for the help! 🙂 You made my day!
BeverlyBrown
Community Manager

This thread totally makes my day! If you video her reaction and she says yes (of COURSE she'll say yes!), post it here so we can celebrate with you.

Register now for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

MichelleHomes
Meteorite | Level 14

Hear Hear! I’m keen to hear the outcome of this beautiful SASsy love story! 

 

You’re a catch Brandon! Robot Happy

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
ChrisHemedinger
Community Manager

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.

 

Binary heart in SAS

binaryheart.png

 

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.)

heart.png

 

Lo, how a polar rose e'er blooming

polarrose2.png

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

Hey Reeza,

 

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:

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/C:\_localdata\temp\demo2.gif.
 
Do you have any idea of what would be causing this? I looked it up myself within the forums, and found something about how the shared folder I created when setting up the SAS utility needs to be where the program directory is. I tried changing the directory within the program text to the folder I used to setup the SAS utility, to no avail. It will still display an "Insufficient authorization to access" error.
 
So, I'm a bit stuck now. 
 
PeterClemmensen
Tourmaline | Level 20

This is by far the most exciting thread I've ever seen on the communities 🙂 🙂

 

Go @grandpastyle13!

grandpastyle13
Obsidian | Level 7

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! 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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