I only see results of my SAS programs in Log like:
16488 title '6';
16489
16490 ods html file = 'E:\Dev\ka\body1.html';
16491
16492
16493 proc means data=learn.blood;
16494 var RBC WBC;
16495 output out = means mean = M_RBC M_WBC;
16496 run;
It's not show any error, but I don't see results in html file.
How to turn on html output?
You may have the setting 'Show results as they are generated' off.
Check your preference settings.
Confirm your HTML file is created as well, though you may need to include a CLOSE before it is fully available.
ods html file = 'E:\Dev\ka\body1.html'
proc means data=sashelp.class;
var height weight;
output out=means mean=M_Height M_Weight;
run;
ods html close;
Works fine for me. I adapted your code slightly to test it:
ods html file="%sysfunc(pathname(work))\body1.html";
proc means data=sashelp.class;
var height weight;
output out=means mean=M_Height M_Weight;
run;
%put Your file has been output to: %sysfunc(pathname(work))\body1.html;
I am seeing results. Are you sure you have observations in your dataset and that there are no errors or warnings being printed to the log?
Related
options date/nodate;
This option has no effect on my html output but it works fine on listing output. Also explain how to print date time on html output same like listing output?
/*----prints date in the upper right side of the output------*/
options dtreset date;
ods listing;
Title; /*I dont want to print any title*/
proc print data=sashelp.class;
run;
ods listing close;
/*----for html ods, date is not printed----------------------*/
options dtreset date;
ods html;
Title; /*I dont want to print any title*/
proc print data=sashelp.class;
run;
ods html close;
Working as designed; according to the documentation:
Note: In an interactive SAS session, the date and time are noted only in the output window.
Output window means the listing destination, by the way (separate from the Results Window which is where modern ODS destinations, including HTML, go).
If you want it in HTML, you'll need to add it to the title:
title "(other things) &sysdate.";
Or &Sysdate9. if you prefer that format.
Some other ways to do this are discussed in Art Carpenter's Placing Dates in Your Titles.
I'm trying to create an output for a requestor that wants me to take a preexisting report that comes in two columns on a single page and break it apart on that single page into different subsections, which they want indicated by a new title in the middle of the page where the new subsection begins.
What I have right now is:
ods pdf file=_pdf_ newfile=none startpage=no columns=2 notoc contents=no
style=swsp;
ods text = 'EMPLOYER RENEWAL DATA';
proc report data=renewal_data;
...
run;
ods startpage=now;
ods text='FINANCIAL DATA (FULL PROGRAM YEAR)';
proc report data=financial_data_total;
...
run;
ods startpage=now;
title1 '$ACA_YR_STR. ACADEMIC YEAR DATA';
footnote;
ods text='APPLICANT DATA';
...
run;
What I want is the page to have a section title where the second ods startpage=now is located that treats the entire page as one column, but then returns to two columns for the remainder of the page.
Thanks!
If you have SAS 9.4 (and possibly 9.3), you can use ODS LAYOUT to achieve this pretty easily. You need to create a gridded layout, and then change your title to another ODS TEXT (which you can of course style to be like a title). Titles go with PROCs, not by themselves, so if you actually use title it will appear where the next PROC REPORT goes, not in its own area.
Here's a barebones example that might get you started. See the ODS REGION and ODS LAYOUT documentation for more information. Note, this is something that is in production, but is also in active development, so different versions of SAS (including newer ones) may change how some of this works (though hopefully not break formerly existing functionality, who knows).
ods pdf file="c:\temp\test.pdf" startpage=no newfile=none notoc contents=no
style=swsp;
options obs=10;
ods layout gridded columns=2 rows=3;
ods region row=1 column=1;
ods text = 'CLASS DATA';
proc report data=sashelp.class;
columns name age;
run;
ods region row=1 column=2;
ods text='CAR DATA';
proc report data=sashelp.cars;
columns make model;
run;
ods region column_span=2 row=2 column=1;
ods text='ACROSS THE WHOLE PAGE NOW';
footnote;
ods region row=3 column=1;
ods text='NOT ACROSS WHOLE PAGE FOR THIS PART';
proc report data=sashelp.baseball;
columns name team;
run;
ods layout end;
ods pdf close;
I want to be able to print all of my reports to external files but only display a select few in the results viewer. In the below example I want reportA and reportB to be displayed AND printed (file.xls) but reportC to be printed to a separate file (file2.csv) and not displayed in the results viewer. Any ideas?
ods msoffice2k file="/file/file.xls";
proc print data=reportA;
run;
proc print data=reportB
run;
ods msoffice2k close;
ods csvall file="/file/file2.csv";
proc print data=reportC;
run;
ods csvall close;
You can also use ODS EXCLUDE and ODS SELECT to target specific destinations.
For example, ods html select none; will turn off the HTML destination temporarily, but not actually close it - it just won't get any results for a while. You can then use ods html select all; to turn it back on.
You can also use ods html exclude all; to do the same thing and then turn it back on with ods html exclude none;.
With either statement, you can also use a where statement in the ods select/exclude to filter to only affect one specific part of an output. See the documentation for more details.
Close the list output which is the default. OR the HTML if that is the default results window in your system. Re-open the output after the file is created.
ods msoffice2k file="/file/file.xls";
proc print data=reportA;
run;
proc print data=reportB
run;
ods msoffice2k close;
ods listing close;
ods html close;
ods csvall file="/file/file2.csv";
proc print data=reportC;
run;
ods csvall close;
ods listing;
ods html;
I actually found a better solution through using the proc export feature for suppressing display of the csv output.
ods msoffice2k file="/file/file.xls";
proc print data=reportA;
run;
proc print data=reportB
run;
ods msoffice2k close;
proc export data=reportC
outfile="/file/file2.csv"
dbms=dlm
replace;
delimiter=",";
run;
Thanks for the help #Reeza I'll keep those settings in mind for future projects.
Is it possible to include submitted syntax or even output of log file when ODS into a PDF using SAS?
For instance, give this simple code:
ods pdf file = "c:\temp\myPDF.pdf";
proc reg data = mydata;
model y = x;
run;
ods pdf close;
I can get the regression output and accompanying graph fine. But is it possible to incorporate into PDF the enclosed command like this?
proc reg data = mydata;
model y = x;
run;
It is, but it requires a couple of hoops. Luckily, you could wrap this into macros to clean up your code.
Create a temporary fileref to hold your log.
Start your PDF and output the log to the fileref.
Write code.
Stop writing log to fileref.
Print file contents to PDF using ODF TEXT=
Hope this helps
filename x temp;
ods pdf file="c:\temp\temp.pdf";
title "Cost of Power";
options source;
proc printto log=x;
run;
proc reg data=sashelp.cars;
model msrp = horsepower;
run;
quit;
proc printto;run;
title;
ods pdf startpage=now; /*Force a new page in the PDF*/
data _null_;
infile x;
input;
call execute("ods text='LOG: "||_infile_||"';");
run;
ods pdf close;
filename x ;
I've been trying to figure out a way to output DFBETAS produced in PROC REG to a SAS data object. I know that residuals, internal and external studentized residuals, and leverage can be outputted by using the output option, for example:
proc reg data=dataset;
model y = x1 + x2;
output out=influence_stats r=r student=int_r rstudent=ext_r h=leverage;
run;
but it doesn't seem that PROC REG provides an option to output DFBETAS. Thank you!!
http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter2/sasreg2.htm
ODS OUPTUT is your answer (for basically anything like this - if it's not coming out on the output dataset, ODS OUTPUT can get almost anything that goes to the output window). The example in the book isn't very good style - I would not put the ODS OUTPUT statement in the middle of the proc - but it ought to work. (You probably need an ODS OUTPUT CLOSE; statement later on.) How I'd do it:
ods output outputstatistics=outstats;
proc reg data=dataset;
model y = x1 + x2;
output out=influence_stats r=r student=int_r rstudent=ext_r h=leverage;
run;
ods output close;
More on ODS OUTPUT: http://www2.sas.com/proceedings/forum2008/086-2008.pdf - in particular read the part where they show you how to use ODS TRACE to figure out which table to use.