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 (November 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 28 Nov 2006 09:04:28 -0600
Reply-To:   Yu Zhang <zhangyu05@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Yu Zhang <zhangyu05@GMAIL.COM>
Subject:   Re: ODS Options in Proc Print
Comments:   To: brodkorbtd <Tyson.D.Brodkorb@wellsfargo.com>
In-Reply-To:   <1164723865.763756.133980@j44g2000cwa.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

Hi, Brodkorbtd,

Thank you for providing the working code.

1. I need to get rid of the by line at the top of each section - "City = xxxxxx".

Option nobyline;

will take care of it. the option will suppress the byline. for more information, please look up the SAS online DOC.

2. I want to make the "City Total" row in each group bold.

The inline formatting feature was provided with the version 8.2 or later. So you can do more customized output with different ODS destinations.

The link: http://support.sas.com/rnd/base/topics/expv8/inline82.html

The highlighted lines in the modified program should give you what you want.

HTH

Yu

OPTIONS LS=72 nobyline;

ods listing close; options orientation=landscape ls=256 ps=600 missing = '' nodate; ods escapechar='^'; ods pdf file='c:\test.pdf' style = Journal notoc;

DATA A; INPUT (JAN FEB MAR) (10.2) CITY 3. PRODUCT 3.; YTD = SUM(JAN,FEB,MAR); /* Calculate year-to-date totals. */ CARDS; 24519.21 27210.54 21546.00 1 1 28349.28 24318.06 29783.49 1 2 16283.82 18122.33 19323.83 1 3 29816.00 31233.19 26984.51 1 4 21926.00 22905.00 24936.86 1 5 28196.59 23590.06 23215.10 1 6 19321.55 18417.52 21562.41 2 1 24217.14 21015.27 19218.33 2 2 12157.12 15378.58 13582.33 2 3 31072.68 31243.90 32945.31 2 4 30548.12 32847.22 29430.45 2 5 21726.47 20720.93 20722.83 2 6 24672.50 19143.00 16588.09 3 1 23476.51 24981.85 20611.72 3 2 19161.47 19445.70 18892.28 3 3 34145.37 31427.36 30661.78 3 4 25934.46 28316.00 27186.06 3 5 22578.63 24548.37 25618.23 3 6 ; RUN;

PROC SORT; BY CITY; RUN;

PROC FORMAT; VALUE CCODES 1='RALEIGH NC' 2='CHARLOTTE NC' 3='WINSTON-SALEM NC'; VALUE PCODES 1='AMPLIFIERS' 2='RECEIVERS' 3='TURNTABLES' 4='TAPE DECKS' 5='SPEAKERS' 6='OTHER AUDIO' 7=" ^S={font_weight=bold font_size=12pt} City Total ^S={}"; RUN;

PROC MEANS NOPRINT SUM; BY CITY; VAR JAN FEB MAR YTD; OUTPUT OUT=B SUM=JAN FEB MAR YTD; /* Output CITY totals. */ RUN;

DATA C; SET A B(IN=B); BY CITY; /* Interleave original observations with totals. */ IF B THEN PRODUCT = 7; RUN;

/* PRINT report. */ PROC PRINT style(table) = {frame = box rules = all borderwidth = 1 just = center} style(header) = {background = lightgrey just = center font_size = 7 pt font_weight = Bold} style(data) = {just = center font_size = 7 pt};

BY CITY;

VAR PRODUCT JAN FEB MAR YTD; FORMAT JAN FEB MAR YTD 12.2 CITY CCODES. PRODUCT PCODES.; TITLE1 'FIRST QUARTER SALES FOR SUNY STEREO INC.'; TITLE2 'IN DOLLARS BY CITY'; RUN; ods pdf close; ods listing;

On 11/28/06, brodkorbtd <Tyson.D.Brodkorb@wellsfargo.com> wrote: > > I'm using code similar to the following to print a data set. I'm > having problems doing two things: > 1. I need to get rid of the by line at the top of each section - > "City = xxxxxx" > 2. I want to make the "City Total" row in each group bold. > > Any help is greatly appreciated. > > I'm running on SAS 9.1.3 Service Pack 2. > > Here is my sample code: > > OPTIONS LS=72; > > ods _all_ close; > options orientation=landscape ls=256 ps=600 missing = '' nodate; > ods pdf style = Journal notoc; > > DATA A; > INPUT (JAN FEB MAR) (10.2) CITY 3. PRODUCT 3.; > YTD = SUM(JAN,FEB,MAR); /* Calculate year-to-date totals. */ > CARDS; > 24519.21 27210.54 21546.00 1 1 > 28349.28 24318.06 29783.49 1 2 > 16283.82 18122.33 19323.83 1 3 > 29816.00 31233.19 26984.51 1 4 > 21926.00 22905.00 24936.86 1 5 > 28196.59 23590.06 23215.10 1 6 > 19321.55 18417.52 21562.41 2 1 > 24217.14 21015.27 19218.33 2 2 > 12157.12 15378.58 13582.33 2 3 > 31072.68 31243.90 32945.31 2 4 > 30548.12 32847.22 29430.45 2 5 > 21726.47 20720.93 20722.83 2 6 > 24672.50 19143.00 16588.09 3 1 > 23476.51 24981.85 20611.72 3 2 > 19161.47 19445.70 18892.28 3 3 > 34145.37 31427.36 30661.78 3 4 > 25934.46 28316.00 27186.06 3 5 > 22578.63 24548.37 25618.23 3 6 > ; > RUN; > > PROC SORT; > BY CITY; > RUN; > > PROC FORMAT; > VALUE CCODES 1='RALEIGH NC' 2='CHARLOTTE NC' > 3='WINSTON-SALEM NC'; > VALUE PCODES 1='AMPLIFIERS' 2='RECEIVERS' 3='TURNTABLES' > 4='TAPE DECKS' 5='SPEAKERS' 6='OTHER AUDIO' > 7=' CITY TOTAL'; > RUN; > > PROC MEANS NOPRINT SUM; > BY CITY; > VAR JAN FEB MAR YTD; > OUTPUT OUT=B SUM=JAN FEB MAR YTD; /* Output CITY totals. */ > RUN; > > DATA C; SET A B(IN=B); > BY CITY; > /* Interleave original observations with totals. */ > IF B THEN PRODUCT = 7; > RUN; > > /* PRINT report. */ > PROC PRINT > style(table) = {frame = box > rules = all > borderwidth = 1 > just = center} > style(header) = {background = lightgrey > just = center > font_size = 7 pt > font_weight = Bold} > style(data) = {just = center > font_size = 7 pt}; > > BY CITY; > > VAR PRODUCT JAN FEB MAR YTD; > FORMAT JAN FEB MAR YTD 12.2 CITY CCODES. PRODUCT PCODES.; > TITLE1 'FIRST QUARTER SALES FOR SUNY STEREO INC.'; > TITLE2 'IN DOLLARS BY CITY'; > RUN; >


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