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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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