What do you mean by the PRINT statement??? PROC PRINT??? PROC REPORT???
Consider the example at the bottom of this post. The PROC PRINT output does not "rewrite" the graph. This is because if you look at the underlying HTML, you will see that the SAS/GRAPH procedure causes ODS HTML to insert an <IMG> tag into the HTML output file. The image is not embedded into the HTML file -- only the <IMG> tag appears in the HTML file.
ods html path='c:\temp' (url=none)
proc print data=sashelp.class;
proc gchart data=sashelp.class;
vbar age /discrete sumvar=height type=mean;
Thanks, that helped alot. but with the same above. suppose I wanted to format the values (say height) and for some reason it was a percentage. How could i set it so that the values displays a percentage sign?
Also aside from this, is there any reason why I should use proc report over proc print?
If you wanted to format HEIGHT, you would use a FORMAT statement in a procedure that used FORMAT statements, such as:
format height fmt-name.;
For percentages, you have to know ahead of time whether the number has been multiplied by 100 or not. For example -- let's say you have a variable called PCTVAL with a number like .3456 -- the SAS pre-defined PERCENT format would do an automatic multiply by 100 -- so the number could display as 34% or 34.56% depending on your format: PERCENT8.0 or PERCENT8.2 (this means you have to know what your number looks like). Your FORMAT statement would be:
[pre]format PCTVAL percent8.2;[/pre]
If your number had already been multiplied by 100 and was stored as 34.56, then you would NOT want to use the pre-defined PERCENT format. In order to just attach a percent sign without doing the multiply by 100, you would need to define your own PICTURE format, as described here (and in previous forum postings): http://support.sas.com/kb/36/495.html
(the note talks about using a PICTURE format with PROC TABULATE because that is a procedure that calculates percents, but automatically does a multiply by 100)
To use a PICTURE format, such as the one described in the Tech Support note, you would, again, use a FORMAT statement:
[pre]format PCTVAL mypct.;[/pre]
As to whether you should use PROC PRINT or PROC REPORT it really is up to you -- PROC REPORT can produce both detail (one report row for every obs) as well as summary reports (one report row represents the summary of multiple obs); while PROC PRINT can only do detail reports; PROC PRINT will produce a sub-total and a grand-total; PROC REPORT can produce one or the other or both. PROC REPORT allows you to highlight an entire row based on some value; PROC PRINT only allows the highlighting of individual cells. PROC REPORT has the COMPUTE block that lets you adjust processing, create custom text strings at a break and perform conditional highlighting (such as one row with commas and another row with dollar signs). PROC REPORT allows you to put spanning headers in your header area -- PROC PRINT does not.
But if all you need is a simple detail report of your dataset -- PROC PRINT is quick and definitely easy to use. PROC REPORT syntax is a bit more verbose. If you were going to "pre-summarize" your data with PROC MEANS, for example and then do a PROC PRINT, I'd recommend switching to PROC REPORT because it can do the summarizing and the report in the same step. But if all you needed was a simple detail report, and you're just starting out, I'd probably recommend PROC PRINT.