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

Hi!
I have been trying to learn from Robert Allison's SAS Graphics site. 

I found SAS 9.4 does not refresh the output after the first run, when I was compiling this code:
http://robslink.com/SAS/democd26/kpidash.sas

 

Question 1: Is there a way to refresh the output file, after the initial run?

 

Question 2: Is there a way to run this the above code in SAS Studio?

 

Thanks in advance,

Jijil Ramakrishnan

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

And in case anyone's curious what the output looks like, here's an example:

 

kpidash.png

View solution in original post

6 REPLIES 6
GraphGuy
Meteorite | Level 14

Using Proc Greplay (to arrange multiple graphs on the page) can be a bit 'tricky'...

 

When you're creating the individual graphs, they are stored in gsegs, using the name specified in the name= option of the graph procedures. The first time you run the code, all works well. But if you run the same code again in the same SAS session, the graph procedures see that the gseg names have already been used, and then they "help you out" by appending a number onto the gseg name (rather than giving you an easy way to overwrite the same name). And then when Proc Greplay tries to display the gsegs on the page, it is displaying the old graphs from the first run (because those names are hard-coded in greplay's treplay command).

 

Here are a few work-arounds ...

 

1- Each time you run the job, exit out of SAS and start a new SAS session - this way the gseg names start from scratch each time you run the job. This is my preferred method.

 

2 - Add some code to the job to delete the gsegs, so the gseg names can be re-used again (without exiting SAS and starting a new SAS session). The following code might work (in some versions of SAS).

 

proc greplay igout=work.gseg nofs; delete _all_; 
run; quit;

3 - Use unique names for the gsegs each time you generate the individual graphs, and then use those unique names in the Proc Greplay treplay (rather than re-using the same names each time). This could probably be done with some macro code, but the length limit of the gseg names (I think it is limited to 8 characters?) might make this a bit cumbersome.

 

Hopefully these tips help!

 

JAR
Obsidian | Level 7 JAR
Obsidian | Level 7

Though it did not work with the version I have, I think this is what I was looking for.

I would like to ask you the following: Is there a way I can run this code (code http://robslink.com/SAS/democd26/kpidash.sas) in SAS studio or other online SAS Viya versions?

 

@GraphGuy Are you the owner of the code I have posted above?

Reeza
Super User

@JAR wrote:

Though it did not work with the version I have, I think this is what I was looking for.

I would like to ask you the following: Is there a way I can run this code (code http://robslink.com/SAS/democd26/kpidash.sas) in SAS studio or other online SAS Viya versions?

 


Yes it can be updated to run in Studio.

 

%let pngdir=kpidash_dir;

Can be changed to a directory that's available.

 

%let pngdir = %sysfunc(pathname(work))/kpidash_dir;

Change:

systask command "md &pngdir" taskname="makedir";

To use the DLCREATEDIR option instead to create the directory.

 

options dlcreatedir;
libname png "&pngdir.";
options nodlcreatedir;

 

And then make sure the ODS HTML have assigned file outputs. 

 

The PROC GSLIDE was the last one that I couldn't quite figure out and don't have time to debug it anymore. 

 

Basically run it, where ever you find errors go back and fix the paths in the order they appear and you should be able to get it working.

GraphGuy
Meteorite | Level 14

Sorry - I've never run this code in SAS Studio or Viya. I have only run it in batch mode, from the DOS command line "sas.exe kpidash.sas". If you're interested in running SAS jobs 'old school' like me, here are more details: http://robslink.com/SAS/papers/using_sas/using_sas.htm

 

GraphGuy
Meteorite | Level 14

And in case anyone's curious what the output looks like, here's an example:

 

kpidash.png

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 736 views
  • 1 like
  • 4 in conversation