Hi, I got a problem, supposedly I try to to set to a printer some output with orientation as landscape, but when printed it's like I sent it as portrait. When I set the papersize to A4, it get a mess, so I changed to the exact size of A4 (papersize=("21cm","29.7cm")
).
The program is used to make the output is the following.
%macro grafico_rbp(txtTipoTema);
goptions horigin=0 cm vorigin=5 cm hsize=35 cm vsize=10 cm HTEXT=1.1 HTITLE=1 /*BORDER /*device=actximg*/;
proc gplot data=l2.fuente_&txtTipoTema;
plot rbp*NUMPREGHOJA /nolegend noframe hminor=3 vminor=1 lvref=1 lhref=1 chref=black cvref=black caxis=black ctext=black grid;
run;
%mend;
%macro grafico_p(txtTipoTema);
ODS PDF STARTPAGE=NEVER;
ODS PRINTER STARTPAGE=NEVER;
goptions horigin=0 cm vorigin=5 cm hsize=35 cm vsize=10 cm HTEXT=1.1 HTITLE=1/*BORDER /*device=actximg*/;
proc gplot data=l2.fuente_&txtTipoTema;
plot p*NUMPREGHOJA /nolegend noframe hminor=3 vminor=1 lvref=1 lhref=1 chref=black cvref=black caxis=black ctext=black grid;
run;
%mend;
%macro GrafRBP_P_pdf(txtTipoTema);
ods pdf startpage=now;
title7 J=C "&desAreaGrupo";
title8 J=C "&desTipoTema";
title9;
symbol2 color=black interpol=join value=dot height=0.1 width=0.1;
/*formato de la linea que unira los puntos del ploteo*/
ods layout absolute y=0in x=0in width=10in;
ods proclabel = "&txtArea - &txtGrupo - &txtTipoTema";
ods region HEIGHT = 12 cm y = 1 cm;
%grafico_rbp(&txtTipoTema);
ods region HEIGHT = 12 cm y = 14 cm;
%grafico_p(&txtTipoTema);
ods layout end;
%mend;
goptions reset=global htext=1.5 ftext=swiss1 nodisplay;
goptions reset=all;
/*goptions device=png display;*/
options orientation=landscape papersize=("21cm","29.7cm");
options nonumber nodate copies=&txtCopias;
ods listing close;
ods noptitle;
ods escapechar="^" USEGOPT;
ods printer style = ceprepuc nogtitle nogfootnote;
ods pdf file = "&rutasal" style = Ceprepuc startpage=never nogtitle nogfootnote;
%GrafRBP_P_pdf(&txtTipoTema);
ods pdf close;
ods printer close;
The output I get when using landscape orientation:
The output should be like this as expected for landscape orientation:
Thank you for reading this long post, I hope I can get some help.
I don't see where you're setting the page orientation?Usually that's via:options orientation=landscape;
NVM, it's in the last program.
What exact version of SAS are you running?
ie 9.4TS1M6?
Thanks again for your time.
By running proc setinit, I got this, on Enterprise Guide :
Current version: 9.04.01M3P062415
I haven't checked the log when I was executing the code, because this pieces of code were given to me to modify it so the output was the expected.
But it displays this :
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ;
NOTE: No units specified for the HTEXT option. The current units associated with GUNIT will be used.
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): goptions reset=global htext=1.5 ftext=swiss1 nodisplay;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): goptions reset=all;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): options orientation=landscape papersize=("21cm","29.7cm");
SYMBOLGEN: La macro variable TXTCOPIAS se resuelve en 1
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): options nonumber nodate copies=1;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods listing close;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods noptitle;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods escapechar="^" USEGOPT;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods printer style = ceprepuc nogtitle nogfootnote;
SYMBOLGEN: La macro variable RUTASAL se resuelve en
c:\p\ceprepuc\2016-2\PR\2\LE-NE\Salidas\Grafico de Rbp y P por Pregunta LECTURA.pdf
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods pdf file = "c:\p\ceprepuc\2016-2\PR\2\LE-NE\Salidas\Grafico
de Rbp y P por Pregunta LECTURA.pdf" style = Ceprepuc startpage=never nogtitle nogfootnote;
NOTE: Writing ODS PDF output to DISK destination
"c:\p\ceprepuc\2016-2\PR\2\LE-NE\Salidas\Grafico de Rbp y P por Pregunta LECTURA.pdf",
printer "PDF".
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
MPRINT(GRAFRBP_P_PDF): ods pdf startpage=now;
SYMBOLGEN: La macro variable TXTANO se resuelve en 2016
SYMBOLGEN: La macro variable TXTCICLO se resuelve en 2
SYMBOLGEN: La macro variable TXTTIPOPR se resuelve en PR
SYMBOLGEN: La macro variable TXTNUMEVAL se resuelve en 2
MPRINT(GRAFRBP_P_PDF): ;
SYMBOLGEN: La macro variable DESAREAGRUPO se resuelve en AREA : LETRAS - GRUPO : NO ESCOLARES
MPRINT(GRAFRBP_P_PDF): title7 J=C "AREA : LETRAS - GRUPO : NO ESCOLARES";
SYMBOLGEN: La macro variable DESTIPOTEMA se resuelve en LECTURA
MPRINT(GRAFRBP_P_PDF): title8 J=C "LECTURA";
MPRINT(GRAFRBP_P_PDF): title9 ;
SYMBOLGEN: La macro variable FDATE se resuelve en 08/09/19
MPRINT(GRAFRBP_P_PDF): ;
MPRINT(GRAFRBP_P_PDF): symbol2 color=black interpol=join value=dot height=0.1 width=0.1;
MPRINT(GRAFRBP_P_PDF): ods layout absolute y=0in x=0in width=10in;
WARNING: Absolute layout is not supported for TAGSETS.SASREPORT13(EGSR) destination. Layout will
be ignored.
WARNING: WIDTH exceeds available space for PRINTER destination. This option will be ignored.
WARNING: WIDTH exceeds available space for PDF destination. This option will be ignored.
SYMBOLGEN: La macro variable TXTAREA se resuelve en LE
SYMBOLGEN: La macro variable TXTGRUPO se resuelve en NE
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
MPRINT(GRAFRBP_P_PDF): ods proclabel = "LE - NE - LC";
MPRINT(GRAFRBP_P_PDF): ods region HEIGHT = 12 cm y = 1 cm;
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
NOTE: No units specified for the HTEXT option. The current units associated with GUNIT will be
used.
MPRINT(GRAFICO_RBP): goptions horigin=0 cm vorigin=5 cm hsize=35 cm vsize=10 cm HTEXT=1.1
HTITLE=1 ;
NOTE: No units specified for the HTITLE option. The current units associated with GUNIT will be
used.
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
MPRINT(GRAFICO_RBP): proc gplot data=l2.fuente_LC;
Sistema SAS
MPRINT(GRAFICO_RBP): plot rbp*NUMPREGHOJA /nolegend noframe hminor=3 vminor=1 lvref=1 lhref=1
chref=black cvref=black caxis=black ctext=black grid;
MPRINT(GRAFICO_RBP): run;
WARNING: HSIZE exceeds available space for PRINTER destination. Setting HSIZE=7.481667in.
WARNING: HSIZE exceeds available space for PDF destination. Setting HSIZE=7.48in.
NOTE: 1 observation(s) contained a MISSING value for the rbp * numpreghoja request.
NOTE: 1 observation(s) contained a MISSING value for the rbp * numpreghoja request.
NOTE: 1 observation(s) contained a MISSING value for the rbp * numpreghoja request.
NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of this
session.
NOTE: 36525 bytes written to
D:\Users\jklau\AppData\Local\Temp\SEG6760\SAS Temporary
Files\_TD3316_C061561_\Prc2\gplot.png.
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
MPRINT(GRAFICO_RBP): ;
MPRINT(GRAFRBP_P_PDF): ;
MPRINT(GRAFRBP_P_PDF): ods region HEIGHT = 12 cm y = 14 cm;
WARNING: REGION placement exceeds available space for PRINTER destination. Setting Y=11.00243cm.
WARNING: REGION placement exceeds available space for PDF destination. Setting Y=11.66707cm.
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
MPRINT(GRAFICO_P): ODS PDF STARTPAGE=NEVER;
MPRINT(GRAFICO_P): ODS PRINTER STARTPAGE=NEVER;
NOTE: No units specified for the HTEXT option. The current units associated with GUNIT will be
used.
MPRINT(GRAFICO_P): goptions horigin=0 cm vorigin=5 cm hsize=35 cm vsize=10 cm HTEXT=1.1 HTITLE=1;
NOTE: No units specified for the HTITLE option. The current units associated with GUNIT will be
used.
NOTE: There were 36 observations read from the data set L2.FUENTE_LC.
NOTE: PROCEDIMIENTO GPLOT used (Total process time):
real time 1.07 seconds
cpu time 0.35 seconds
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
MPRINT(GRAFICO_P): proc gplot data=l2.fuente_LC;
MPRINT(GRAFICO_P): plot p*NUMPREGHOJA /nolegend noframe hminor=3 vminor=1 lvref=1 lhref=1
chref=black cvref=black caxis=black ctext=black grid;
MPRINT(GRAFICO_P): run;
WARNING: HSIZE exceeds available space for PRINTER destination. Setting HSIZE=7.481667in.
WARNING: HSIZE exceeds available space for PDF destination. Setting HSIZE=7.48in.
NOTE: 30117 bytes written to
D:\Users\jklau\AppData\Local\Temp\SEG6760\SAS Temporary
Files\_TD3316_C061561_\Prc2\gplot1.png.
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
MPRINT(GRAFICO_P): ;
MPRINT(GRAFRBP_P_PDF): ;
MPRINT(GRAFRBP_P_PDF): ods layout end;
MPRINT(GRAFRBP_P_PDF): quit;
NOTE: There were 36 observations read from the data set L2.FUENTE_LC.
NOTE: PROCEDIMIENTO GPLOT used (Total process time):
real time 0.21 seconds
cpu time 0.10 seconds
Sistema SAS
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
MPRINT(GRAFRBP_P_PDF): ;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ;
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods pdf close;
NOTE: ODS PDF printed 1 page to c:\p\ceprepuc\2016-2\PR\2\LE-NE\Salidas\Grafico de Rbp y P por
Pregunta LECTURA.pdf.
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ods printer close;
NOTE: ODS PRINTER printed 1 page.
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
SYMBOLGEN: La macro variable DSNAME se resuelve en WORK.ZFMMEM.UTILITY
MPRINT(GRAF_P_RBP_TIPOTEMA_PDF): ;
MPRINT(GENVALDIF_TIPOTEMA): ;
SYMBOLGEN: La macro variable TXTTIPOTEMA se resuelve en LC
SYMBOLGEN: La macro variable TXTCARPETA se resuelve en c:\p\ceprepuc
SYMBOLGEN: La macro variable TXTANO se resuelve en 2016
SYMBOLGEN: La macro variable TXTCICLO se resuelve en 2
SYMBOLGEN: La macro variable TXTTIPOPR se resuelve en PR
SYMBOLGEN: La macro variable TXTNUMEVAL se resuelve en 2
SYMBOLGEN: La macro variable TXTAREA se resuelve en LE
SYMBOLGEN: La macro variable TXTGRUPO se resuelve en NE
SYMBOLGEN: La macro variable TITTIPOTEMA se resuelve en LECTURA
I might think about getting one of the outputs to work, such as the PDF without any of the ODS Printer.
When multiple ODS destinations are open and you get conflicts, such as the PRINTER not supporting ODS Layout, the resulting interactions may be quite problematic.
I know that I have experimented with ODS PDF creating quite large images. So that problem may be another interaction of the destinations.
The older SAS graph procedures such as GPLOT are called device-based graphics for a reason. You really do need to pay attention to the actual device used. That could be another conflict between the desired size. I strongly suggest changing the code to use SGPLOT to get away from the devices. I remember some real issues with getting some desired appearances because of printer driver versions and the active destination device when the SAS/Graph procedures (or the line printer plots) were all that was available.
Have you turned off the default EG specification for the ODS destination?
This might be due to a conflict between EG setting the values and then your code setting them.
@DonH , that seems to be interesting, how could I do that, sir?
Thank you very much.
There might be a better way. But if you click on properties for the program then select Customize result formats . . . . and then make sure none of the checkboxes are selected, EG won't generate an ODS statement.
Thank you everybody, I had to mix every advice you all gave me, and it was solved.
I don't know who should I mark as the solution because everybody helped in this problem.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.