BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jteres
Obsidian | Level 7

Is it possible to create a panel graph and include some annotation in each panel?

For example, I have a panel graph where each panel is a series of line graphs. I'd like to have a spot in each panel that lists, say, the proportion of the sample shown in each panel. Is there a way to do this with GTL? I haven't seen any example of this but I would love to be able to to do it.

Thanks,

Jed

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Your best option with SAS 9.3 is to use GTL's LAYOUT DATAPANEL with the INSET option. In 9.3, the inset data is MERGED (not match-merged) with the original data such that it is applied ordinally to each cell. We added match-merge ability in SAS 9.4, as well as give you the ability to use insets with SGPANEL. Below is a simple example for 9.3. There are addition options for insets to control features such as appearance and position.

Hope this helps!

Dan

data inset;

label numstud = "Number of students";

numstud = 9; output;

numstud = 10; output;

run;

proc sort data=sashelp.class out=class; by sex; run;

data merged;

merge class inset;

run;

proc template;

define statgraph mypanel;

begingraph;

layout datapanel classvars=(sex) / columns=2 inset=(numstud);

  layout prototype;

    scatterplot x=age y=height;

  endlayout;

endlayout;

endgraph;

end;

run;

proc sgrender data=merged template=mypanel; run;

View solution in original post

5 REPLIES 5
DanH_sas
SAS Super FREQ

What version of SAS are you running?

jteres
Obsidian | Level 7

Sorry, it's been a while. My Forum Decorum is rusty! I'm using 9.3.


DanH_sas
SAS Super FREQ

Sorry, one more question. You asked about doing this in GTL, but you also have a tag about SGPANEL. Can you post a snippit of your graph code?

jteres
Obsidian | Level 7

I asked about both because I know from experience that some things are possible only with writing a custom graph template, but right now I'm using sgpanel until I hit its limitations.

my code is something like:

proc sgpanel ;

panelby num_courses num_credits ;

series x = month y = gpa / group = class_yr ;

run ;

so there's a line for each class (e.g., Class of 2014) that traces GPA over time on the same chart, with separate panels based on the number of courses and credits attempted.

what I'd like is to have sone text In each panel listing the total number of students who are represented in each panel as well as the percentage of the total that represents.

thanks,

jed

DanH_sas
SAS Super FREQ

Your best option with SAS 9.3 is to use GTL's LAYOUT DATAPANEL with the INSET option. In 9.3, the inset data is MERGED (not match-merged) with the original data such that it is applied ordinally to each cell. We added match-merge ability in SAS 9.4, as well as give you the ability to use insets with SGPANEL. Below is a simple example for 9.3. There are addition options for insets to control features such as appearance and position.

Hope this helps!

Dan

data inset;

label numstud = "Number of students";

numstud = 9; output;

numstud = 10; output;

run;

proc sort data=sashelp.class out=class; by sex; run;

data merged;

merge class inset;

run;

proc template;

define statgraph mypanel;

begingraph;

layout datapanel classvars=(sex) / columns=2 inset=(numstud);

  layout prototype;

    scatterplot x=age y=height;

  endlayout;

endlayout;

endgraph;

end;

run;

proc sgrender data=merged template=mypanel; run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1192 views
  • 0 likes
  • 2 in conversation