LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 10 Oct 2004 17:13:25 -0700
Reply-To:     Roger DeAngelis <xlr82sas@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roger DeAngelis <xlr82sas@AOL.COM>
Organization: http://groups.google.com
Subject:      Re: Discouraged with Version 9.1 of SAS
Content-Type: text/plain; charset=ISO-8859-1

Hi All,

With 'Proc Document' you can combine Tables, Lisings and Graphs into one word document.

Here is an example of the Replay verb( full sample attached )

ods rtf file="c:\dem.rtf" style=trgrtf;

title;footnote;

proc document name=doc.tlg;

replay \print#1\print#1; replay \gchart#1\bar#1; replay \tabulate#1\report#1\table#1; replay \freq#1\sex_by_age#1\crosstabfreqs#1; replay \ghart#2\ByGroup1#1\Trt#1; replay \freq#1\sex_by_eth#1\crosstabfreqs2#1; replay \ghart#2\ByGroup2#1\Trt1#1; replay \Means#1\ByGroup1#1\Summary#1; replay \Means#1\ByGroup2#1\Summary#1;

run; quit;

ods rtf close; run;

"Proc Document' is experimental and buggy in SAS Version 8.2. Other than for experimentation, I would not use 'proc document'.

However, it should bring SAS closer to a true publishing package, like Quark, Adobe Pagemaker, Adobe InDesign, Adobe Framemaker or MS-Publisher.

Proc document does not support 'Proc report' in Version 8.2, and does not support most options in 'Proc Print', ie 'Id' or 'Label'.

What "Proc Document should do in the future"

1. Page layout and the flowing of text around graphics. 2. Multiple graphics and Tables on one page 3. Table of Contents and Index ( some of this is in V8.2, but I could not get it to work). 4. Tight integration with Postscript, Pdf, Rtf and Html ( no support for Cgm??)

What Proc Document 'may not do'.

1. Will not work with Cgm files 2. Will not fix the the longstanding Microsoft Word Cgm import filter bugs.

Regards Roger

/*--------------------------------------------------------------*\ | | | | | This code produces tables and graphs and then | | assembles the output into one rtf/Ms-Word Document. | | | | Proc Document may provide 'page layout' for hundreds | | of TLGs into one word document. | | Version 9 of proc document will do page layout? | | | | | | SAS looks like it is targeting the Abobe Pagemaker, | | Framemaker, Quark and MS-Publisher market | | | | | | You will need to store your outputs for replay | | | | | | You store your TLGs in | | | | C:\Tlg.sas7btim | | | | | | This code will create a single word doc from your TLGs. | | | | | | libname Doc V8 "C:\" | | | | ods rtf file="c:\dem.rtf" style=trgrtf; | | | | title;footnote; | | | | proc document name=Doc.Tlg; | | | | replay \print#1\print#1; | | replay \gchart#1\bar#1; | | replay \tabulate#1\report#1\table#1; | | replay \freq#1\sex_by_age#1\crosstabfreqs#1; | | replay \freq#1\sex_by_eth#1\crosstabfreqs2#1; | | replay \Means#1\ByGroup1#1\Summary#1; | | replay \Gchart#2\ByGroup1#1\Trt#1; | | replay \Means#2\ByGroup2#1\Summary#1; | | replay \Gchart#2\ByGroup2#1\Trt1#1; | | | | run; | | quit; | | | | ods rtf close; | | run; | | | | | | | | Proc Document is not ready for production | | | | 1. Proc document is full of bugs in V8.2 | | 2. No support for Proc Report in V8.2 | | 3. Very questionable for Cgm ( better with postscript/Pdf ) | | | | | | | \*--------------------------------------------------------------*/

/*--------------------------------------------------------------*\ | | | Template used for Tables and listings | | | \*--------------------------------------------------------------*/

libname doc v8 "c:\";

proc datasets library=work kill; run;

%Macro Utl_TrgRtf ( style=TrgRtf, bottommargin=.75in, topmargin=.75in, rightmargin=1.25in, leftmargin=1.25in, frame=hsides, rules=groups

) / Des="SAS Rtf Template for Target";

Proc Template; define style &Style; parent=styles.rtf;

replace fonts / 'docFont' =("Arial",12.1pt)

'FixedFont' =("Courier",12.1pt) 'BatchFixedFont' =("Courier",12.1pt) 'FixedStrongFont' =("Courier",12.1pt) 'FixedHeadingFont' =("Courier",12.1pt) 'FixedEmphasisFont' =("Courier",12.1pt)

'EmphasisFont' =("Arial",12pt) 'HeadingEmphasisFont'=("Arial",12pt,Bold)

'StrongFont' =("Arial",12.1pt) 'HeadingFont' =("Arial",12.1pt,Bold)

'TitleFont' =("Arial",12.1pt,Bold) 'TitleFont2' =("Arial",12.1pt,Medium)

;

style table from table / protectspecialchars=off frame=&frame rules=&rules font=fonts('docFont') borderwidth = .1pt cellpadding = 1pt cellspacing = 1pt;

replace HeadersAndFooters from Cell /

font = fonts('docFont') foreground=colors('datafg') background=colors('databg') protectspecialchars=off;

replace SystemFooter from TitlesAndFooters /

font=fonts('docFont') just=c;

replace body from Document /

bottommargin=&bottommargin topmargin =&topmargin rightmargin =&rightmargin leftmargin =&leftmargin ; end; run; quit;

%Mend Utl_TrgRtf;

/*--------------------------------------------------------------*\ | | | Create | | Demographic Table for TLGs | | | \*--------------------------------------------------------------*/ Proc Format ;

Value $Trt2Des

'Med'='Medication' 'Pbo'='Placebo'

; run;

Data Dem ( Label="Sample Demog Data for Pro Document" Keep= Sex Age Hgt Wgt Trt Eth );

Retain Trt Sex Eth Age Hgt Wgt;

Format Age Hgt Wgt 3.;

Length Sex $8;

Label Sex = 'Gender' Age = 'Age(Yrs)' Hgt = 'Height(Cm)' Wgt = 'Weight(kg)' Trt = 'Treatment' Eth = 'Ethinicity' ;

Set SasHelp.Class ( Rename= ( Height=Hgt Weight=Wgt ) ) ;

If Uniform(-1) < .5 Then Trt='Pbo'; Else Trt='Med';

If Uniform(-1) < .5 Then Eth='AfrAmr'; Else Eth='Latino';

If Sex='F' Then Sex='Female'; Else Sex='Male';

Run;

Proc Sort Data=Dem Out=DemSrt; By Trt Sex; Run;

/*----------------------------------------------------*\ | Create Template | \*----------------------------------------------------*/

%Utl_TrgRtf ( style=TrgRtf, bottommargin=.75in, topmargin=.75in, rightmargin=.5in, leftmargin=.5in, frame=box, rules=all );

title;footnote; options nodate nonumber orientation=landscape center;run;

/*----------------------------------------------------*\ | Program really begins here | | Store Tables, Listings and Graphs for replay | | | \*----------------------------------------------------*/

/*----------------------------------------------------*\ | Proc Print Example | \*----------------------------------------------------*/

ods document name=Doc.Tlg(write);

Proc Print Data=DemSrt Width=Full Label; run;

Ods Document Close;

/*----------------------------------------------------*\ | Tabulate example | \*----------------------------------------------------*/

ods document name=Doc.Tlg(Update); /* could leave document open but wanted to show update capability */ proc tabulate data=DemSrt missing;

format Trt $Trt2Des.;

class Eth Sex Trt; classlev Eth Sex Trt;

keyword n pctn;

table (Sex Eth), Trt=' '* (n='N'*f=7. pctn<Sex Eth>=' %' *f=pctpct. ) / box=[label='Baseline '] rts=43; run;

/*----------------------------------------------------*\ | Gchart Example | \*----------------------------------------------------*/

goptions reset=all rotate=landscape vsize=7.4in hsize= 7.4in htext=3 ;

/* seems to be problems with footnote space when replaying */ /* may be associated with my rtf margins */

title; footnote1 " "; footnote2 " "; footnote3 " "; footnote4 " "; footnote5 " ";

proc gchart data=DemSrt;

Label Age='Age';

hbar Age / discrete sumvar=Wgt name="Bar" subgroup=Hgt nolegend nostats

;

run; quit;

/*----------------------------------------------------*\ | Means example | \*----------------------------------------------------*/

proc Means data=DemSrt; by Trt; var Wgt Hgt; run;

/*----------------------------------------------------*\ | Gchart Example with by statement | \*----------------------------------------------------*/

goptions reset=all rotate=landscape vsize=7.4in hsize= 7.4in htext=3 ;

/* seems to be problems with footnote space when replaying */ /* may be associated eith rtf margins */

title; footnote1 " "; footnote2 " "; footnote3 " "; footnote4 " "; footnote5 " ";

proc gchart data=DemSrt; by trt;

Label Age='Age';

hbar Age / discrete sumvar=Wgt name="Trt" subgroup=Hgt nolegend nostats

;

run; quit;

/*----------------------------------------------------*\ | Proc Freq Table | \*----------------------------------------------------*/

Proc Freq Data=DemSrt; Tables Sex*Age/missing; Tables Sex*Eth/missing; run;

ods rtf close; run;

ods Document close;

/*----------------------------------------------------*\ | This will list the saved outputs | \*----------------------------------------------------*/

proc document name=Doc.Tlg; list/levels=all; run; quit;

/*----------------------------------------------------*\ | This will replay your saved TLGs | \*----------------------------------------------------*/

ods rtf file="c:\dem.rtf" style=trgrtf;

title;footnote;

proc document name=doc.tlg;

replay \print#1\print#1; replay \gchart#1\bar#1; replay \tabulate#1\report#1\table#1; replay \freq#1\sex_by_age#1\crosstabfreqs#1; replay \Gchart#2\ByGroup1#1\Trt#1; replay \freq#1\sex_by_eth#1\crosstabfreqs2#1; replay \Gchart#2\ByGroup2#1\Trt1#1; replay \Means#1\ByGroup1#1\Summary#1; replay \Means#1\ByGroup2#1\Summary#1;

run; quit;

ods rtf close; run;

DavidF@HOMEGAIN.COM (David Fickbohm) wrote in message news:<C0F6DD0E8F3B9040A77F857FCFAC452A18AD0C@homegain1.homegain.com>... > Poeple, > Am I understanding you correctly ? Proc Report is NOT supported in version > 9.1 of SAS? > Thanks > Dave > > -----Original Message----- > From: Don Stanley [mailto:don_stanley@PARADISE.NET.NZ] > Sent: Friday, October 08, 2004 2:48 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Discouraged with Version 9.1 of SAS > > > and proc print .... > > WARNING: PROC PRINT does not fully support the ODS Document in this release. > > I wonder what is supported. proc tabulate I suppose, which most of my > users run a mile from. > > Don > > Jack Hamilton wrote: > > > Yes, it's disappointing that PROC REPORT doesn't support ODS documents. > > Perhaps someone at WUSS next week will tell me what the future plans > > are. > > > > Most of what can be done with PROC REPORT can be done with PROC > > TABULATE. > > > > > > > > > > -- > > JackHamilton@FirstHealth.com > > Manager, Technical Development > > Metrics Department, First Health > > West Sacramento, California USA > > > > > >>>>"Roger DeAngelis" <xlr82sas@AOL.COM> 10/07/2004 3:08 PM >>> > > > > Hi All, > > > > First I tried > > > > proc sql; > > select median(age) from Sashelp.class; > > quit; > > > > But it returned each age. > > > > I realize there is no sense of order in a relational database and > > the median would be difficult to implement. Looks like the > > median is even less useful than the 'montonic' fuction > > > > Next I tried to use 'proc document' with 'proc report' and > > got a response that 'report' was not supported. (Tabulate and Print > > are supported) > > Regards > > Roger > > > >


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