Showing posts with label SAS unix ODS pdf html output. Show all posts
Showing posts with label SAS unix ODS pdf html output. Show all posts

Monday, December 18, 2006

Directing SAS output to a pdf file

ods pdf file= "/usr2/users/student/mkaushik/bio213/testd.pdf";
*** would direct all the output to testd.pdf file*

*ods pdf file ="%sysfunc
(reverse(%sysfunc(substr(%sysfunc(reverse(%sysfunc(reverse(%scan(%sysfunc(reverse(%sysfunc(getoption(sysin)))),1,/))))),5)))).pdf";
goptions reset=global device=gif ftitle=swissb ftext=swissb htitle=2 htext=2;


data weights;
infile '/usr2/users/student/mkaushik/ne/lbw1';
****change the above line to reflect where you have saved lbw.dat**;

input id low age lwt race smoke ptl ht ui ftv bwt;
run;

proc means;
var age lwt bwt;
run;

proc univariate plot;
var age lwt bwt;
run;

proc gplot;
plot bwt*lwt;
proc corr pearson spearman;
var bwt lwt;

proc gplot data =results;
plot bwt*lwt= '.' pred1*lwt='*' lowerm*lwt='L' upperm*lwt='U'/ overlay;
run;

quit;
ods pdf close;

Making nice plots & name ods html files after SAS files

Output Delivery System (ODS) is a preferred way of making nice tables and graphs.
I recommend using following statement which automatically directs the ODS output to a file with the same name and in the same directory as the program. The following code makes a html file. HTML files can be viewed in UNIX (using lynx) as well as Windows , open quickly and cut pasted easily in Document and Spreadsheet programs.

(remove spaces from following to make this work)
ods html file ="%sysfunc
(reverse(%sysfunc(substr(%sysfunc(reverse(%sysfunc(reverse
(%scan(%sysfunc(reverse(%sysfunc(getoption(sysin)))),1,/))))),5)))).html"
STYLE=MINIMAL;

gpath="/usr2/users/student/mkaushik/web/";

data=
.
.
proc anova;
.
run;

ods html close;



For an html file with frames, you can enter the following code spanning the proc statements

ods html body="/usr2/users/student/mkaushik/web/mixed_output.html"
contents="/usr2/users/student/mkaushik/web/mixed_contents.html"
frame="/usr2/users/student/mkaushik/web/mixed_frame.html";

proc
.
.
run;

ods html close;



In this ODS statement there are three files:

1. BODY which specifies the file to contain the output from the PROC.
2. CONTENTS which specifies the file to contain the table of contents.
3. FRAME which specifies the file to contain reference to the table of contents and the output from the PROC.