Hi all,
I want to draw 8 curves on the same graph by using the following code. I have 4 groups of PR and 2 groups of FD inside each group of PR. This code working perfectly to draw for groups of PR. So, I'm looking for editing this code to have them all together on the same graph.
What should I do for this code?
PROC SORT DATA = FAT;
BY PR;
RUN;
proc nlin data = FAT method = marquardt;
parms A = 15 B = -0.19 C = 0.0012 ;
by pr ;
model TEST_DAY_MILK_kg = A * Time **b * exp(-C*Time);
output out = Fitmilk predicted = MKG ;
symbol1 interpol= none value = star color= black;
symbol2 interpol = none value = none color = red;
run;QUIT;
proc sort data=fitmilk; by time;run;quit;
proc sgplot data=fitmilk;
series y=MKG x=time / group= pr ;
yaxis values = (0 TO 40 BY 5 );
xaxis values = (1 to 12 by 1);
run;
My best regards
Ibrahim
One way would be to create a single variable that contains the information from both PR and FD such as concatenation and use that variable for the Group variable. That would be easily done in a data step before SGPLOT.
You may want to investigate using a DATTRMAP data set to control appearances of the groups such as having similar marker for the PR value but different color for the FD value so the relationships are easier to see if that is a desire.
Use the techniques in the article "Plot curves for levels of two categorical variables." The article shows how to concatenate the levels of the two variables to create a new variable that can be used on the GROUP= option.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.