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

Is there any way to save the name of current style to macro variable? I want to write a macro that draw some graphics in specific style. That's why I want to save current state of opened destinations and their styles, change style to my macro's style, run macro and turn settings back to original. I have not found any function which returns current style name or destination state (opened or not). Maybe there is another way to implement such mechanics or i missed something?

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There is a view in SASHELP which holds the output destinations and the style associated with them.  Do:

data test;
  set sashelp.vdest;
run;

And you can see them.  I would however question why you have programs which need to output things, when destinations already exist.  Sounds a bit to overcomplex.  Each program, or output component should specify its own output parameters, it keesp the information encapsulated.  Otherwise whoever has to use your code later on then has to trawl through other code trying to figure out what is going on.  

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There is a view in SASHELP which holds the output destinations and the style associated with them.  Do:

data test;
  set sashelp.vdest;
run;

And you can see them.  I would however question why you have programs which need to output things, when destinations already exist.  Sounds a bit to overcomplex.  Each program, or output component should specify its own output parameters, it keesp the information encapsulated.  Otherwise whoever has to use your code later on then has to trawl through other code trying to figure out what is going on.  

lightmiker
Calcite | Level 5

Thanks, that's exactly what I need. My macro draws one graph with specific colors and fonts. I want that settings to be used only for that specific graph. That's why I decided to isolate that temporary change of style within the macro. I dont want to specify that temporary style by hands every time I run macro.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Not sure I am following you on the process there.  I would always specify before any output procedure, the destination options, style etc. even if calling a macro to do the graph, e.g.

%macro draw_graph();
   proc sgplot...;
%mend draw_graph;

ods _all_ close;
ods rtf file="...\file.rtf" style=statistical;
%draw_graph;
ods rtf close;

In the above code, I call a macro, but the file setup and such like is done by me, I would never rely on what is already there, or try to revert to it after the fact.

lightmiker
Calcite | Level 5

I got your point. Maybe I should to save my macro style as permanent and manually set it before calling the macro to make things clear... Anyway thanks for helping with sashelp.vdest. It is a new stuff for me Smiley Happy.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1336 views
  • 0 likes
  • 2 in conversation