Solved
Contributor
Posts: 67

# PLOTTING MULTIPLE GRAPHS

[ Edited ]

Hi guys

I would like to plot four lactation curves on the same graph by pr, (PR) is a categorical number. which is represented observations that came from year one, two, three and four.

in my dataset, I have PR 1, 2,  3, and 4.

this code that I have plottered all the PRS in one curve,

How can I change this code to plot all the lactations in one place?

``````  proc nlin data = ALLfd method = marquardt;
parms A = 15 B = -0.19 C = 0.0012 ;
by pr  ;
AXIS1 ORDER = (5 TO 45 BY 5 );
model TEST_DAY_milk_kg = A * Time **b * exp(-C*Time);
output out = Fit predicted = pred ;
symbol1 interpol= join value = star color= black;
symbol2 interpol = none value = none color = red;
run;
QUIT;
proc sort data=fit;
by time;
RUN;
proc gplot data=fit;
plot pred*time TEST_DAY_milk_kg*time/overlay VAXIS = AXIS1;
run;quit;``````

Kind regards

Ibrahim

Accepted Solutions
Solution
‎03-09-2018 12:18 PM
SAS Super FREQ
Posts: 4,245

## Re: PLOTTING MULTIPLE GRAPHS

You haven't provided an image of what you want, but try this:

``````proc sgplot data=fit;
series y=pred x=ttime / group=pr;
series y=TEST_DAY_milk_kg x=time / group=pr;
run;``````

All Replies
Solution
‎03-09-2018 12:18 PM
SAS Super FREQ
Posts: 4,245

## Re: PLOTTING MULTIPLE GRAPHS

You haven't provided an image of what you want, but try this:

``````proc sgplot data=fit;
series y=pred x=ttime / group=pr;
series y=TEST_DAY_milk_kg x=time / group=pr;
run;``````
Contributor
Posts: 67

## Re: PLOTTING MULTIPLE GRAPHS

``````
proc nlin data = fdfdfd method = marquardt;
parms A = 15 B = -0.19 C = 0.0012 ;
by pr  ;
AXIS1 ORDER = (0 TO 1 BY 0.1 );
model TEST_DAY_fat_kg = A * Time **b * exp(-C*Time);
output out = Fit predicted = pred ;
symbol1 interpol= none value = star color= black;
symbol2 interpol = none value = none color = red;
run;
QUIT;
proc sort data=fit; by time;
run;

proc sgplot data=fit;
series y=pred x=time / group=pr;
run;``````

Hi Pick_SAS

this code has done everything that I  was looking for except this code can not appear my request, it is only present the default programme numbers.

What do you think the issue is?

regards

``AXIS1 ORDER = (0 TO 1 BY 0.1 );``

SAS Super FREQ
Posts: 4,245

## Re: PLOTTING MULTIPLE GRAPHS

To change the ticks on the X axis, use the XAXIS statement:

``````proc sgplot data=fit;
series y=pred x=time / group=pr;
xaxis values=(0 to 1 by 0.1);
run;``````

Here is a link to the documentation of PROC SGPLOT. You can also search for questions online, such as

change ticks "proc sgplot" site:sas.com

☑ This topic is solved.

Discussion stats
• 3 replies
• 180 views
• 1 like
• 2 in conversation