BookmarkSubscribeRSS Feed
WendyT
Pyrite | Level 9

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;

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
WendyT
Pyrite | Level 9

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 618 views
  • 0 likes
  • 2 in conversation