LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 3 Apr 2000 22:12:43 -0700
Reply-To:     Lauren E Haworth <haworthl@MINDSPRING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lauren E Haworth <haworthl@MINDSPRING.COM>
Organization: MindSpring Enterprises
Subject:      Re: ODS styles

Following up again on my earlier response ...

This program just keeps getting better.

Frank Poppe contacted me because he found that this program fails when you have user-defined styles that have short names. What happens is that ODS sets the variable lengths for the output dataset in the ODS call based on the variable lengths in the first style library (the user- defined one). Then when it gets to the next style library (the SAS- supplied one) the variable length for the path variable is too short, and so style names get truncated and the program fails.

Another revision from my friends in Cary solves the problem. The new code follows.

-- Lauren Haworth

***************************************; * SAS ODS Styles Display Program, v3.0 ; ***************************************;

* CREATE A DATASET WITH THE STYLE NAMES; /* create dataset(s) from template information */ ods output Stats(match_all=mvar)=Temp1; proc template; list; run; ods output close;

/* combine datasets after setting variable lengths */ /* (this avoids the problem of variable lengths being too small */ /* because variable in first dataset was smaller than variable */ /* in later dataset(s) */ data TemplateListing; length type $12 path $255; set &mvar; run;

* CREATE MACRO VARIABLES FROM THE STYLE NAMES; data _null_; set TemplateListing end=eof; retain Counter 1; if eof then call symput('NumStyles',Counter); if type="Style" and Path ^= "Styles"; StyleName=Path; StyleNum=trim(left(compress("Style"||Counter))); call symput(StyleNum,StyleName); Counter+1; run;

* CREATE A SIMPLE DATASET; Data Test; input A B C; cards; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ;

* LOOP THROUGH THE STYLES RUNNING A SIMPLE PROC ; %Macro DisplayStyles; *get a frame and a contents started too; ods html frame="c:\temp\styletestframe.htm" contents="c:\temp\styletestcont.htm" body="c:\temp\styletestjunk.htm"; %Do C=1 %to &NumStyles; ods html body="c:\temp\styletest&C..htm" style=&&Style&C; title 'Available Styles'; title2 "This Style is &&Style&C"; ods proclabel "This Style is &&Style&C"; proc print data=Test; run; %End; ods html close; %Mend DisplayStyles; %DisplayStyles;

In article <MPG.134f0f9350be0c498968c@news.mindspring.com>, haworthl@mindspring.com says... > To follow up on my earlier response ... > > So sooner had I posted this program than I got a response from an expert > in Cary with a revision that greatly improves my program. I've attached > the revised code, which organizes the output nicely into frames with a > table of contents. > > - Lauren Haworth > > * CREATE A DATASET WITH THE STYLE NAMES; > * ods listing close; > ods output Stats=TemplateListing; > proc template; > list; > run; > ods output close; > > * CREATE MACRO VARIABLES FROM THE STYLE NAMES; > data _null_; > set TemplateListing end=eof; > retain Counter 1; > if eof then call symput('NumStyles',Counter); > if type="Style" and Path ^= "Styles"; > StyleName=Path; > StyleNum=trim(left(compress("Style"||Counter))); > call symput(StyleNum,StyleName); > Counter+1; > run; > > * CREATE A SIMPLE DATASET; > Data Test; > input A B C; > cards; > 1 2 3 > 4 5 6 > 7 8 9 > 10 11 12 > 13 14 15 > ; > > > * LOOP THROUGH THE STYLES RUNNING A SIMPLE PROC ; > %Macro DisplayStyles; > > *get a frame and a contents started too; > ods html frame="c:\temp\styletestframe.htm" > contents="c:\temp\styletestcont.htm" > body="c:\temp\styletestjunk.htm"; > > %Do C=1 %to &NumStyles;


Back to: Top of message | Previous page | Main SAS-L page