I'm using GTL and SAS v 9.4. Is there a way to vary the lengths of the y-axis in my template (top & bottom graphs using layout lattice/rows=2) so that the lengths of the y-axis (percentage) will be of varying lengths, with the maximum being a certain value, say, 10% above the maximum percentage value in the data? I.e., a "floating" y-axis length for each graph. Thanks.
If you have a LATTICE layout, you can set the ROWWEIGHTS (or COLUMNWEIGHTS) option to make the ROWS (or COLUMNS) of the height you want based on the proportion between the two Y axes. If you want this to be dynamically controlled, you could use ROWWEIGHTS=dynamic, where the dynamic is the the text string providing the values, such as "0.6 0.4" not including the quotes or the parentheses. Then, you can generate this dynamic string based on the use case.
The actual axis length is always computed based on the size of the cell. There is no way to specify an axis length in GTL. If you want, you can keep the cells constant size and set a PAD value to provide more white space above the y-axis.
I won't say "no" but since GTL has to live with other things like ODS GRAPHICS that can set the entire available graphics space then trying to set a fixed length inside GTL is likely to have bad interactions when someone changes display area size.
You could make the axis statement flexible by using a parameter that sets the max value of the axis if you calculate it before the SGRENDER that calls the template.
Generic answer to generic question. If you show your code for the template you may get better suggestions. Best would include some example data in the form of a data step to allow testing code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
thank you ballardw
If you have a LATTICE layout, you can set the ROWWEIGHTS (or COLUMNWEIGHTS) option to make the ROWS (or COLUMNS) of the height you want based on the proportion between the two Y axes. If you want this to be dynamically controlled, you could use ROWWEIGHTS=dynamic, where the dynamic is the the text string providing the values, such as "0.6 0.4" not including the quotes or the parentheses. Then, you can generate this dynamic string based on the use case.
The actual axis length is always computed based on the size of the cell. There is no way to specify an axis length in GTL. If you want, you can keep the cells constant size and set a PAD value to provide more white space above the y-axis.
thank you Sanjay, this works very well for me
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.