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?
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.
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.
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.
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.
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 .
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.