Example: biology

SUGI 23: Better Titles: Using the #BYVAR and …

1 Better Titles: Using The #BYVAR and #BYVAL title OptionsArthur L. CarpenterCalifornia Occidental ConsultantsKEY WORDSBY, #BYVAR, #BYVAL, BYLINE, title variable values it has been possible to place macrooption #BYLINE places the BY-line in the titlevariables in titles and footnotes for quite awhile, of the SAS System and later include the ability to place BY variable valuesThe name of variables in the BY statement canand names in the titles and footnotes as well. be added to a title by Using the #BYVAR titleThese options are only documented in SASoption. The value taken on by the BY variableTechnical Report P-222 and are therefore undercan also be added to a title through the use #BYVAL title names of BY variables and the BY variablevalues are inserted into titles and footnotes usingthe #BYVAR and #BYVAL options.

1 Better Titles: Using The #BYVAR and #BYVAL Title Options Arthur L. Carpenter California Occidental Consultants KEY WORDS BY, #BYVAR, #BYVAL, BYLINE, TITLE variable values easier.

Tags:

  Using, Title, Better, Sugi, Sugi 23, Better titles, Using the

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of SUGI 23: Better Titles: Using the #BYVAR and …

1 1 Better Titles: Using The #BYVAR and #BYVAL title OptionsArthur L. CarpenterCalifornia Occidental ConsultantsKEY WORDSBY, #BYVAR, #BYVAL, BYLINE, title variable values it has been possible to place macrooption #BYLINE places the BY-line in the titlevariables in titles and footnotes for quite awhile, of the SAS System and later include the ability to place BY variable valuesThe name of variables in the BY statement canand names in the titles and footnotes as well. be added to a title by Using the #BYVAR titleThese options are only documented in SASoption. The value taken on by the BY variableTechnical Report P-222 and are therefore undercan also be added to a title through the use #BYVAL title names of BY variables and the BY variablevalues are inserted into titles and footnotes usingthe #BYVAR and #BYVAL options.

2 There areThe following PROC PRINT uses a BYtwo forms of these options and they willstatement with one BY variable (STATION).accommodate more than one BY variable. Several examples will be presented Using to Release of the SAS System, the useof a BY statement with a procedure thatproduced printed output always caused the BY-line to be written to the output. The BY-lineconsists of the variables (or for some procedurestheir labels) in the BY statement and the valuestaken on by those variables. Eliminating the BY-line and or moving the values of the BYvariables into the titles has required the use ofmacro variables. Three new title options arenow available that can be used to make theprocess of controlling the BY-line and the BYThe BYLINE system option controls whether ornot the BY-line will be displayed.

3 A related titleCONTROLLING THE BY-LINE proc printdata= (obs=4);by station;var datetime depth temp ph;title1 'Water Quality Data';run;This code produces the following output (usingthe NOCENTER option for this paper):Water Quality Datastation=TS3 OBS DATETIME DEPTH TEMP 1 06 FEB93:09:15 0 2 06 FEB93:09:15 1 3 06 FEB93:09:15 2 4 06 FEB93:09:15 3 ' CornerCoders' Corner2 Using the NOBYLINE system option will causethe BY-line to not be printed. This informationcould then be added to a title by Using the#BYLINE title option. It is very important tonotice that these title options all start with apound sign (#).options nobyline;proc printdata= (obs=4);by station;var datetime depth temp;title1 'Water Quality Data';title2 'Information for #byline';run;This produces the following output:Water Quality DataInformation for station=TS3 OBS DATETIME DEPTH TEMP 1 06 FEB93:09:15 0 2 06 FEB93:09:15 1 3 06 FEB93:09:15 2 4 06 FEB93:09:15 3 VARIABLE NAMESThe names of one or more of the variables in theBY statement can also be added into the title .

4 The option is #BYVAR and it takes on twoforms. You can name the variable explicitly orimplicitly. In the following example titles 2 and3 show these two forms. The #BYVAR optionexpects the NOBYLINE system option to be ineffect for some procedures - see TechnicalReport P-222 for more nobyline;proc printdata= (obs=4);by station;var datetime depth temp;title1 'Water Quality Data';title2 'Explicit - #byvar(station)';title3 'Implicit - #byvar1';run;This results in the following output: Water Quality DataExplicit - stationImplicit - stationOBS DATETIME DEPTH TEMP 1 06 FEB93:09:15 0 2 06 FEB93:09:15 1 3 06 FEB93:09:15 2 4 06 FEB93:09:15 3 first it may seem rather silly to have an optionof the form #BYVAR(station) in a title whenwhat you want to show is station.

5 Why notjust type in station and be done with it? Although it is more likely that you will use theimplicit form and just specify the position of theBY variable as was done in TITLE3 in the aboveexample, the explicit form may be used whenwriting dynamic code. The option mightbecome #BYVAR(&VAR), where the variablename to be stored in &VAR is unknown whenthe program is VARIABLE VALUESWhen controlling the title text, it is very likelythat you will want to insert the value of the BYvariable for the current page. The #BYVAL option will do this for you. As with the #BYVAR option, it comes in two forms, explicitand implicit. In the following example the valueof the first BY variable is requested implicitly(#BYVAL1). The same request could have beenspecified as #BYVAL(STATION).

6 Proc print data= (obs=4);by station;var datetime depth temp;title1 'Water Quality Data';title2 'Data Collected for #byvar1';title3 '#byval1';This produces the output:Coders' CornerCoders' Corner3 Water Quality DataData Collected for stationTS3 OBS DATETIME DEPTH TEMP 1 06 FEB93:09:15 0 2 06 FEB93:09:15 1 3 06 FEB93:09:15 2 4 06 FEB93:09:15 3 option is smart enough to know to issue apage feed when the BY variable changes on apage with a title containing the #BYVAL option. For PROC PRINT this is the same as Using thePAGEBY the names and values of variables in aBY-line to titles became easier with Release the SAS System. The #BYLINE, #BYVAR, and #BYVAL options can now be used to inserttext and values directly into your examples and information on theseoptions is available in the following publicationsby SAS Institute , Arthur L.

7 And Charles E. Shipp, QuickResults with SAS/GRAPH Software, Cary, NC: SAS Institute Inc., 1995. pp. 47-48, Institute Inc., SAS Guide to Report Writing: Examples, Version 6, First Edition, Cary, NC: SASI nstitute Inc., 1994, pp. Institute, Inc., SAS Technical Report P-222,Changes and Enhancements to Base SAS Software,Release , Cary, NC: SAS Institute Inc., 1991, , 88, , Earl, Using BY Variable TextSubstitution to Add Data Values to SAS/GRAPHT itles and Footnotes, in Proceedings of theNineteenth Annual sugi Conference, Cary, NC: SASI nstitute Inc., 1994, pp. THE AUTHORArt Carpenter s publications listincludes two chapters in Reporting fromthe Field, the books Quick Results withSAS/GRAPH Software, and Carpenter's Complete Guide to the SAS Macro Language, and over two dozen papers andposters presented at sugi , PharmaSUG, andWUSS.

8 Art has been Using SAS since 1976 andhas served as a steering committee chairpersonof both the Southern California SAS User'sGroup, SoCalSUG, and the San Diego SASU sers Group, SANDS; a conference cochair ofthe Western Users of SAS Software regionalconference, WUSS; and Section Chair at theSAS User s Group International conference, sugi . Art is a SAS Quality Partner and throughTMCalifornia Occidental Consultants he teachesSAS courses and provides contract SASprogramming support CarpenterCalifornia Occidental Box 6199 Oceanside, CA 92058-6199(760) INFORMATIONSAS and SAS Quality Partner are registeredtrademarks of SAS Institute, Inc. in the USAand other countries. indicates USA ' CornerCoders' Corner


Related search queries