BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

I have an interesting challenge with TEMPLATE.  I am trying to create a lattice where each plot within the lattice is a panel of graphs. For a single panel of graphs, I can easily do this with SGPANEL, but I need to make a single figure with several different panels. The following TEMPLATE code works just fine to create a 1x4 panel of graphs (instead of using SGPANEL):

 
proc template; 
 define statgraph test12;
 begingraph;
layout datapanel classvars=(type _trt) / rows=1 columns=4;
        layout prototype;
        bandplot x=year limitupper=uclmarg limitlower=lclmarg ;    
       seriesplot x=year y=y / lineattrs=graphFit ;
       scatterplot x=year y=y / markerattrs=(size=8px color=blue symbol=circlefilled) ;
    endlayout;    
endlayout;
endgraph;
end;
run;
I would like to wrap the equivalent of a "LAYOUT LATTICE" around this to have several rows, where each row is a panel of four (or whatever) graphs (with a different response variable for each row). I realize that LAYOUT LATTICE does not allow for DATAPANEL, so I am looking for a workaround. For instance, I would like to use something like:
proc template; 
 define statgraph test12;
 begingraph;
layout lattice / columns=1 rows=3;
   layout datapanel classvars=(type _trt) / rows=1 columns=4;
        layout prototype;
        bandplot x=year limitupper=uclmarg limitlower=lclmarg ;    
       seriesplot x=year y=p / lineattrs=graphFit ;
       scatterplot x=year y=y / markerattrs=(size=8px color=blue symbol=circlefilled) ;
     endlayout;
   layout datapanel classvars=(type _trt) / rows=1 columns=4;
        layout prototype;
        bandplot x=year limitupper=uclmarg2 limitlower=lclmarg2 ;    
       seriesplot x=year y=p2 / lineattrs=graphFit ;
       scatterplot x=year y=y2 / markerattrs=(size=8px color=blue symbol=circlefilled) ;
    endlayout;
 endlayout;
....
endlayout;
endgraph;
end;
run;

Any recommendations on how to do this? Thanks. 
LVM
1 ACCEPTED SOLUTION
2 REPLIES 2

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 2 replies
  • 1616 views
  • 2 likes
  • 2 in conversation