BookmarkSubscribeRSS Feed
Barkamih
Pyrite | Level 9

 

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 

 

2 REPLIES 2
ballardw
Super User

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.

 

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 2 replies
  • 800 views
  • 1 like
  • 3 in conversation