I created this macro to generate trendline for years in the dataset, but unable to define custom colors.
Will you have the same values of Yr_nb all the time? Then look up DATTRMAP= data set option for Proc SGplot to create set of properties such as line color for the values of Yr_nb. That would make the colors consistent across many graphs.
If you want that list in the styleattrs use DATACONTRASTCOLORS instead of datacolors.
I have 3 years in Yr_nb = 2019 2022 and 2023 and the month on month the values for yaxis ctrl_mbr changes. I'm trying to apply a single color for 2019,2022 and 2023
I think in STYLEATTRS you want to use DATACONTRASTCOLORS=() and not DATACOLORS=()
will this defines color for each year ? Thanks for responding
will this defines color for each year ? Thanks for responding
You can try it and find out
@Ananth_kumar wrote:
will this defines color for each year ? Thanks for responding
Kind of depends on your data and what you place in the options. If your data has more group values then you supply on the list for Datacontrastcolors then you are back to colors from your active style and may duplicate. Or if you place the same color in the list more than once it may be pretty hard to tell.
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.