Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Manj
Fluorite | Level 6

I have the below code which is working for keeping all figures in one page, How ever because of the busy data, the graph doesnt show up. Hence I would need to split this into two pages(may me into more pages) . Can anyone help with this?

 

 

proc template;
define statgraph seriesplot ;
begingraph/ designwidth=1100 designheight=640 border = off;

layout lattice / pad=0 rows = 4 columns = 1 ;*rowdatarange = union columndatarange = union rowgutter = 5 columngutter = 5 rowweights= (1) columnweights = (.555 .445);

layout overlay /
xaxisopts=(label="Interval Post-dose" labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015
linearopts = ( tickvaluelist=(1 2 3 7 14 21 28 42 56 70 84 115) tickdisplaylist=('D1' 'D2' 'D3' 'Wk1/D7' 'Wk2/D14' 'Wk3' 'Wk4/Mnth1' 'Wk6' 'Wk8' 'Wk10' 'Wk12' 'Wk52/EOS')
tickvaluefitpolicy=rotate TICKVALUEROTATION =diagonal ))
yaxisopts=(label="Stool (vg/g)" type=log logopts=(base=2 minorticks=false ) labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015);

seriesplot x=visnx y=med_1/ group=studyid name="series" lineattrs=(pattern=1);
ScatterPlot X=visnx Y=med_1 / Group=studyid YErrorUpper=p25_1 YErrorLower=p75_1 NAME="scatter" errorbarattrs=(pattern=1 ) ;
*referenceline x=24/ lineattrs=(pattern=mediumdash ) ;
discretelegend "series" / across=1 down=3 location=inside halign=right valign=top border=false valueattrs=(size=8 ) ;
endlayout;

layout overlay /
xaxisopts=(label="Interval Post-dose" labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015
linearopts = ( tickvaluelist=(1 2 3 7 14 21 28 42 56 70 84 115) tickdisplaylist=('D1' 'D2' 'D3' 'Wk1/D7' 'Wk2/D14' 'Wk3' 'Wk4/Mnth1' 'Wk6' 'Wk8' 'Wk10' 'Wk12' 'Wk52/EOS')
tickvaluefitpolicy=rotate TICKVALUEROTATION =diagonal ))
yaxisopts=(label="Urine (vg/ml)" type=log logopts=(base=2 minorticks=false ) labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015);

seriesplot x=visnx y=med_2/ group=studyid name="series" lineattrs=(pattern=1);
ScatterPlot X=visnx Y=med_2 / Group=studyid YErrorUpper=p25_2 YErrorLower=p75_2 NAME="scatter" errorbarattrs=(pattern=1 ) ;
*referenceline x=24/ lineattrs=(pattern=mediumdash ) ;
discretelegend "series" / across=1 down=3 location=inside halign=right valign=top border=false valueattrs=(size=8 ) ;
endlayout;

layout overlay /
xaxisopts=(label="Interval Post-dose" labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015
linearopts = ( tickvaluelist=(1 2 3 7 14 21 28 42 56 70 84 115) tickdisplaylist=('D1' 'D2' 'D3' 'Wk1/D7' 'Wk2/D14' 'Wk3' 'Wk4/Mnth1' 'Wk6' 'Wk8' 'Wk10' 'Wk12' 'Wk52/EOS')
tickvaluefitpolicy=rotate TICKVALUEROTATION =diagonal ))
yaxisopts=(label="Saliva (vg/ml)" type=log logopts=(base=2 minorticks=false ) labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015);

seriesplot x=visnx y=med_3/ group=studyid name="series" lineattrs=(pattern=1);
ScatterPlot X=visnx Y=med_3 / Group=studyid YErrorUpper=p25_3 YErrorLower=p75_3 NAME="scatter" errorbarattrs=(pattern=1 ) ;
*referenceline x=24/ lineattrs=(pattern=mediumdash ) ;
discretelegend "series" / across=1 down=3 location=inside halign=right valign=top border=false valueattrs=(size=8 ) ;
endlayout;

layout overlay /
xaxisopts=(label="Interval Post-dose" labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015
linearopts = ( tickvaluelist=(1 2 3 7 14 21 28 42 56 70 84 115) tickdisplaylist=('D1' 'D2' 'D3' 'Wk1/D7' 'Wk2/D14' 'Wk3' 'Wk4/Mnth1' 'Wk6' 'Wk8' 'Wk10' 'Wk12' 'Wk52/EOS')
tickvaluefitpolicy=rotate TICKVALUEROTATION =diagonal ))
yaxisopts=(label="Nasal Swab (vg/swab)" type=log logopts=(base=2 minorticks=false ) labelattrs=(size=9pt) tickvalueattrs=(size=8) offsetmin = 0.015 offsetmax = 0.015);

seriesplot x=visnx y=med_4/ group=studyid name="series" lineattrs=(pattern=1);
ScatterPlot X=visnx Y=med_4 / Group=studyid YErrorUpper=p25_4 YErrorLower=p75_4 NAME="scatter" errorbarattrs=(pattern=1 ) ;
*referenceline x=24/ lineattrs=(pattern=mediumdash ) ;
discretelegend "series" / across=1 down=3 location=inside halign=right valign=top border=false valueattrs=(size=8 ) ;
endlayout;

 

endlayout;
endgraph;
end;
run;

proc sgrender data=in template=seriesplot dattrmap=myattr;
dattrvar studyid="studyid";
run;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

I believe the issue here is that you've create a lattice that is four cells high and one cell wide, but your set the the designHEIGHT to be a small 640px and the designWIDTH a lot larger. This setting probably prevents the graph from drawing due to space. Try swapping your designwidth and designheight values and see if you get the graph to appear.

 

Hope this helps!

View solution in original post

5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi: I don't see any PROC REPORT code. This seems to be all PROC TEMPLATE and SGRENDER code.
Cynthia
Manj
Fluorite | Level 6

sorry ,I meant proc template

ballardw
Super User

You would also have to provide example data of your In and Myattr datasets to even have a chance of diagnosing behavior. The data is best provided as a working data step. The data doesn't have to be the same but should demonstrate the same behavior.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

Manj
Fluorite | Level 6

Hi, Below is the attib data that im using.
data myattr;
length id $8 value $40 linecolor $ 6 markercolor $6 textcolor $6;
id='studyid';value='AAA102';linecolor='blue';linepattern=1; markersymbol='circlefilled';markercolor='blue';textcolor='blue';output;
id='studyid';value='BBB123';linecolor='red';linepattern=1; markersymbol='circlefilled';markercolor='red';textcolor='red';output;
id='studyid';value='CCC234';linecolor='green';linepattern=1; markersymbol='circlefilled';markercolor='green';textcolor='green';output;

run;

DanH_sas
SAS Super FREQ

I believe the issue here is that you've create a lattice that is four cells high and one cell wide, but your set the the designHEIGHT to be a small 640px and the designWIDTH a lot larger. This setting probably prevents the graph from drawing due to space. Try swapping your designwidth and designheight values and see if you get the graph to appear.

 

Hope this helps!

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1003 views
  • 0 likes
  • 4 in conversation