Hello SAS folks!
I’m looking for some help in naming html output files with by values (actually two sets of by values). I'm only finding reference to numbers added to a base name.
I see that it can now be done in ODS graphics with imagename= and was hoping for something similar for html. Anchor= gets links in the table of contents, but only for a single bygroup.
In the example below, the body files come out as
shoes-body_.htm
shoes-body_1.htm
--> shoes-body_46.htm
What I want is
shoes-body_Africa_Addis Ababa.htm
shoes-body_Africa_Algiers.htm
--> shoes-body_Western Europe_Rome.htm
(No spaces or a substituted character for them would be fine, if not even better)
We are using 9.4 TS1M6 as remote login to a virtual machine with Windows Server 2016.
Thanks for any help you can give me!
Wendy T.
ods _all_ close ; ods html body = "shoes-body_.htm" contents = "shoes-contents.htm" frame = "shoes-frame.htm" anchor = "#byval(region)" newfile = bygroup ; title "SAS Dataset Shoes" ; title2 "for #byval(Region) and #byval(subsidiary) " ; data shoes ; set sashelp.shoes ; proc sort ; by region subsidiary ; run ; proc print data=shoes ; by region subsidiary ; footnote "Each region in a separate file" ; footnote2 "Can the body files be named with byvalues?" ; run; ods html close;
You could certainly write a macro loop to do this, but I'm not sure its worth the effort.
Thinking out of the box, why not have everything in one .html file with the title above the table indicating the value of the BY variable? You could even have, in the .html file, a table of contents on the left such that if someone wanted to go directly to the Western Europe/Rome analysis, they just click in the table of contents.
Hi Paige-
You're absolutely right... doing it in macro would be more of a pain than it's worth.
I have some graphs (last 6 months of data) and tables (last 3 months of data) next to each other on a wiki page, and currently the links point to names like
_graph1.html, _table1.html
_graph2.html, _table2.html
etc.
Which normally works out fine. Unfortunately, we have been having delays in getting some data back, and as a consequence, I don't have as many "tables" as I ought to, and end up with mismatches. Each output is titled with #byval(), so mismatches are obvious.
Just thought I would ask after finding the new ODS GRAPHICS option.
Wendy T.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.