Hello,
I have the following code working. I am able to get only the last plot in the pdf.
My Problem is: I want to get all 3 charts on a single pdf on a unix server.
Please advise.
data plot;
input _yyyymm yymmn6. var1 var2 var3 group $;
datalines;
200903 1 2 3 grp1
200906 4 5 6 grp1
200909 7 8 9 grp1
200912 10 11 12 grp1
200903 1 2 3 grp2
200906 4 5 6 grp2
200909 7 8 9 grp2
200912 10 11 12 grp2
200903 1 2 3 grp3
200906 4 5 6 grp3
200909 7 8 9 grp3
200912 10 11 12 grp3
;
run;
%macro plot_percentagezero(_varStart=,_varStop=);
/*ods pdf file="/path/on/unix/server/ReportForSAS.pdf" startpage=never;*/
goptions reset=all cback=white border htext=10pt htitle=12pt;
axis1 label=none;
axis2 label=(angle=90 "Percentage");
symbol1 interpol=join color=vibg height=14pt font='Arial' value='80'x; /* GRP1 */
symbol2 interpol=join color=mob height=14pt font='Arial' value='A3'x; /* GRP2 */
symbol3 interpol=join color=depk height=14pt font='Arial' value='A5'x; /* GRP3 */
legend1 repeat=1 shape=symbol(5,2.5) label=none frame;
%do i = &_varStart. %to &_varStop. ;
proc gplot data=PLOT;
plot (var1 var2 var3 )*_YYYYMM / overlay legend=legend1
haxis=axis1 vaxis=axis2;
WHERE lowcase(group)=lowcase("grp&i.");
title "Plot on :: grp&i.";
run;
quit;
%end;
/*ods pdf close;*/
%mend plot_percentagezero;
%plot_percentagezero(_varStart=1,_varStop=3);
See if removing the STARTPAGE=NEVER fixes it.
From the documentation for ODS PDF:
NEVER
specifies not to insert page breaks, even before graphics procedures.
CAUTION:Each graph normally requires an entire page. The default behavior forces a new page after a graphics procedure. STARTPAGE=NEVER turns off that behavior, so specifying STARTPAGE= NEVER might cause graphics to overprint.
See if removing the STARTPAGE=NEVER fixes it.
From the documentation for ODS PDF:
NEVER
specifies not to insert page breaks, even before graphics procedures.
CAUTION:Each graph normally requires an entire page. The default behavior forces a new page after a graphics procedure. STARTPAGE=NEVER turns off that behavior, so specifying STARTPAGE= NEVER might cause graphics to overprint.
I'd like to notice one thing, your topic title mentioned for SGPLOT whereas given SAS code is for GPLOT. SGPLOT and GPLOT are different SAS procedures, aren't it?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.