BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pau13rown
Lapis Lazuli | Level 10

i am using the following code

 

proc sgpanel data=dataset noautolegend;
  format ....;
  panelby cohort / onepanel spacing=2 headerattrs=(size=14) novarname;
  vline timevar / response=var stat=mean limits=both markers group=grps;
  rowaxis label="my variable" labelattrs=(size=16) valueattrs=(size=14) ;
  colaxis label="time" labelattrs=(size=16) valueattrs=(size=14) ;
run;
quit;

 

but i want to plot box plots over time, not the mean and CI which this is producing. I can't see any way to do this using sgpanel. I could do something like "vbox var / category=timevar" but then i lose grps (each panel should have 2 series of box plots over time, one for each group, and time is discrete/categorical)

 

cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

The vbox statement in sgpanel does support the group= option, at least in version 9.4M5

PG

View solution in original post

6 REPLIES 6
ballardw
Super User

@pau13rown wrote:

i am using the following code

 

proc sgpanel data=dataset noautolegend;
  format ....;
  panelby cohort / onepanel spacing=2 headerattrs=(size=14) novarname;
  vline timevar / response=var stat=mean limits=both markers group=grps;
  rowaxis label="my variable" labelattrs=(size=16) valueattrs=(size=14) ;
  colaxis label="time" labelattrs=(size=16) valueattrs=(size=14) ;
run;
quit;

 

but i want to plot box plots over time, not the mean and CI which this is producing. I can't see any way to do this using sgpanel. I could do something like "vbox var / category=timevar" but then i lose grps (each panel should have 2 series of box plots over time, one for each group, and time is discrete/categorical)

 

cheers!


Why is there no VBOX or HBOX if you want box plots? If you want separate box plots at each "time" then add that variable to your panelby statement though sometimes getting the row and column settings to match what you intend is tricky.

 

If you are attempting to combine a Vline and a box then you will need to move over to Graphics Template language as HBOX and VBOX cannot be combined with other plot statements in SGPanel (at least not in my SAS 9.4 according to the documentation)

The VBOX statement cannot be used together with other plot statements in the SGPANEL procedure. Box plots can be overlaid with other box plots. However, overlaid box plots must have the same category variables.

A minimal example data set with (dummy values for your variables if sensitive) to create a few cohort/time combinations would help provide a more complete example.

pau13rown
Lapis Lazuli | Level 10

adding time to panelby would just generate a whole bunch more panels, one for each timepoint. Imagine a single figure within a single panel. In that figure i want timepoint on the x axis. There is no vbox in my code because it wouldn't produce what i need, that's the problem. My suspicion is that i need to use sgplot and greplay, but i hope not because that would be a hassle. I appreciate that's it's maybe not easy to visualise, i'd provide an example of what i need but nothing appears in a google search, that's why im asking here....

PGStats
Opal | Level 21

The vbox statement in sgpanel does support the group= option, at least in version 9.4M5

PG
pau13rown
Lapis Lazuli | Level 10

excellent, youre right, it worked! it doesn't appear in the help page so i thought it wasnt an option: http://support.sas.com/documentation/cdl/en/grstatproc/62603/HTML/default/viewer.htm#panelvbox-stmt....

PGStats
Opal | Level 21

Check out the version number. That's the help page for version 9.2, it's 10 years old! Smiley Happy

PG
pau13rown
Lapis Lazuli | Level 10

i need to bookmark the current sas help weblink 🙂

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 1824 views
  • 3 likes
  • 3 in conversation