Data visualization with SAS programming

Panel Graph with annotation

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

Panel Graph with annotation

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


Accepted Solutions
Solution
‎02-11-2014 10:11 AM
SAS Super FREQ
Posts: 889

Re: Panel Graph with annotation

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


All Replies
SAS Super FREQ
Posts: 889

Re: Panel Graph with annotation

What version of SAS are you running?

Contributor
Posts: 25

Re: Panel Graph with annotation

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


SAS Super FREQ
Posts: 889

Re: Panel Graph with annotation

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?

Contributor
Posts: 25

Re: Panel Graph with annotation

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

Solution
‎02-11-2014 10:11 AM
SAS Super FREQ
Posts: 889

Re: Panel Graph with annotation

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;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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