BookmarkSubscribeRSS Feed
Snow_Belssas
Calcite | Level 5
Dear SAS experts

Any of you has done to add a reg (or Loess smooth) line into SGPANEL-VLINE plot. The line can be added when the panel plot is scatter (or just in SGSCATTER). However, when I wanted the VLINE panel (kind of subject profile plot), then adding an extra reg or Loess smoth line seems to be not possible.
Any idea about that? Many thanks in advance.

Best SSAS
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
Have a look at the VLINE doc:
http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/vline-stmt.htm

where it says that:
The VLINE statement can be combined only with other categorization plot statements in the SGPLOT procedure.

Since both REG and LOESS are fit or confidence plots, they won't be able to be used with the VLINE. A description of how the different plot statements can be categorized is here:
http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003199399.htm#a003199431

You may get some ideas about using the SG procedures in clinical programming situations from this paper:
http://support.sas.com/resources/papers/proceedings09/174-2009.pdf

cynthia
Snow_Belssas
Calcite | Level 5
Many thanks to you, Cynthia

Originally I have done that just adding a mean profile line for a grayed spaghetti plot for a group of subjects in SAS 8.2, 9.13. I was too happy to see version 9.2 now having that VLINE panel plot which gives much ease on this kind of graph. However, from your suggested doc limks, I have see no way to do that in SG PROCs yet, so I shall keep using my old fashioned GREPLAY. Anyway, many thanks.

Kind regards
SSAS
Cynthia_sas
SAS Super FREQ
Hi:
I'm having a hard time visualizing a "mean profile line for a grayed spaghetti plot" in a panel layout. But I believe that both REG and LOESS allow the BAND and the REFLINE statements to be used with them. Since everything in the SGPLOT is overlaid, perhaps you can use REFLINE/BAND to convey what you want. Tech Support could help you figure it out if you opened a track with them.

These are also some very useful links on using the SG procedures:
Effective Graphics Made Simple Using SAS/GRAPH® SG Procedures --
http://www2.sas.com/proceedings/forum2008/255-2008.pdf

SG Procedures and Clinical Trial Reporting:
http://support.sas.com/resources/papers/proceedings09/174-2009.pdf

Overview by Delawich & Slaughter on SGPLOT Procedure:
http://support.sas.com/resources/papers/proceedings09/158-2009.pdf

cynthia
Snow_Belssas
Calcite | Level 5
Hi, Cynthia

Thanks again for your suggestion.

Put it simple, I made a paneled (by group) spaghetti plot (on different time points)with all lines grayed and added into every panel one line for the group mean values (on different time points). The REFLINE/BAND does not fit that purpose. So far my client is still happy to see what I did by using GREPLAY. Else I have to send my request to SAS support. However, I was wondering if SGRENDER can do something about that if I have time.

Kind Regards
SSAS
Cynthia_sas
SAS Super FREQ
Hi:
I don't know exactly what statements you'd use in the Graph Template Language to produce a plot as you describe, but -if- the statements are there and -if- they will work together, then it is theoretically possible that you could design a custom panelled graph template to use with SGRENDER.

The place where I'd start is with one BY group or with 1 subset. Get the plot you want with SGPLOT and then run the procedure with the TMPLOUT= option. The TMPLOUT option instructs the SG procedures to make a file from the graph template statements that are built internally from your SG procedure code. That means if you have an SGPLOT that you really like and it only needs a few tweaks, that you can make those tweaks by modifying the GTL and then using SGRENDER to render the new STATGRAPH template.

[pre]
proc sgplot data=lib.dataset
tmplout='c:\temp\my_sg_tmpl.txt';
title "Your Plot";
... statements for your plot ...
run;
[/pre]

Next, I'd take the my_sg_tmpl.txt file and see what Graph Template Language statements are used and whether they'll work with the other statements you need. This site contains information on GTL statements:
Rules of assembly -- which types of plots can be overlaid and work together: http://support.sas.com/documentation/cdl/en/grstatug/61950/HTML/default/n0kqozn49yx2lon1aavkll1f5dff...
More information:
http://support.sas.com/documentation/cdl/en/statug/59654/HTML/default/statug_odsgraph_sect047.htm
http://support.sas.com/documentation/cdl/en/grstatug/61950/HTML/default/p0qjj7cwxzzaiun1rzevg5gg9w6h...

Then, as you add statements to your GTL program let's say that you create a graph template called GRAPH.MYPLOT, you can test the template with this code:

[pre]
proc sgrender data=lib.dataset
template=graph.myplot;
run;
[/pre]

SGRENDER by itself, will not do anything for you. You'd have to build your custom template with the GTL in order for SGRENDER to render it. If you find that you need help generating the GTL statements, you can open a track with Tech Support for more help with your data and your particular graph design.

cynthia

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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