Data visualization with SAS programming

ODS PDF: graphs disappear when switching from columns=2 to columns=1

Reply
New Contributor
Posts: 2

ODS PDF: graphs disappear when switching from columns=2 to columns=1

SAS version: 9.04.01M1P120413

Problem: ODS pdf is not giving me the expected results when switching from columns=2 to columns=1.  This is illustrated in the second page produced by the code below.  There should be three graphs printed to page 2, but it only prints the last two graphs...the first graph disappears.  How can I make is so all three graphs are on page 2?

Example plot code below

data data1;

call streaminit(123);

do type='TYPE1','TYPE2','TYPE3';

  do population='pop1','pop2','pop3','pop4';

  do time = '1-1','1-2','1-3','1-4','2-1','2-2','2-3','2-4';

    y1 = rand("Uniform");    y2 = rand("Uniform")/2;

    output;

  end;

  end;

end;

run;

data data2;

call streaminit(123);

do category='category1','category2','category3','Other';

  do time = '1-1','1-2','1-3','1-4','2-1','2-2','2-3','2-4';

    y1 = rand("Uniform");    y2 = rand("Uniform")/2;    y3 = rand("Uniform")/3;

    output;

  end;

end;

run;

/* ------------PLOTS---------------*/

ods pdf file="C:\data.pdf" startpage=never columns=2;

ods graphics on /height=8in width=4in border=off;


proc sgpanel data=data1;

title "Graph of Y1, by type";

panelby population /columns=1 rows=4;

series x=time y=Y1 /markers group=type;

keylegend /position=top;

run;

proc sgpanel data=data1;

title "Graph of Y2, by type";

panelby population /columns=1 rows=4;

series x=time y=Y2 /markers group=type ;

keylegend /position=top;

run;

ods pdf startpage=now columns=1;

ods graphics on /height=3in width=7in border=off;


proc sgplot data=data2;

title "Graph of Y1, by category";

series x=time y=Y1 /markers group=category;

keylegend /location=outside position=top;

run;

ods graphics on /height=3in width=7in border=off;

proc sgplot data=data2 NOAUTOLEGEND;

title "Graph of Y2, by category";

series x=time y=Y2 /markers group=category;

run;

ods graphics on /height=3in width=7in border=off;

proc sgplot data=data2 NOAUTOLEGEND;

title "Graph of Y3, by category";

series x=time y=Y3 /markers group=category;

run;


Ods pdf close;

Ask a Question
Discussion stats
  • 0 replies
  • 243 views
  • 0 likes
  • 1 in conversation