Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Find code for function

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-05-2018 12:47 PM
(1542 views)

```
proc nlin data = new 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;
proc gplot data=fit;
plot pred*time TEST_DAY_MILK_KG*time/overlay VAXIS = AXIS1;
run;quit;
```

Hi guys

This is Ibrahim, I'm looking for your help if you don't mind !!!

How I can use this occasion P = -(B+1)*LOG(C) for the previous model and the correct order for the code, this occasion can calculate the cow persistency of wood's question. **P MEANS PERSISTENCY **

** **

Wood's question already applied as you see and I had a good output.

kind regards

Ibrahim

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Your translation tool is making your questions very difficult to understand.

Maybe all you want is a way to calculate persistency from estimates of A, B, C. Something like:

```
proc nlin data = new outest=ESTIMATES;
parms A = 15 B = 0.19 C = -0.0012 ;
bounds A B C > 0;
by pr;
model TEST_DAY_MILK_KG = A * Time **b * exp(-C*Time);
output out = Fit predicted = Pred ;
run;
proc sql;
create table persistency as
select
pr,
A, B, C,
-(B+1)*LOG(C) as P
from ESTIMATES
where _TYPE_ = "FINAL";
select * from persistency;
quit;
```

(untested)

PG

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Just guessing from your post of last November, you should try SG procédures for graphing. Example

```
proc nlin data = new;
parms A = 15 B = 0.19 C = -0.0012 ;
bounds A B C > 0;
by pr ;
model TEST_DAY_MILK_KG = A * Time **b * exp(-C*Time);
output out = Fit predicted = Pred ;
run;
QUIT;
proc sort data=fit; by pr time; run;
proc sgplot data=fit;
series x=time y=pred / group=pr;
scatter x=time y=TEST_DAY_MILK_KG / group=pr;
run;
```

(untested)

PG

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Than you so much for this code

but I'm looking to code this occasion P = -(B+1)*LOG(C) in order to get it's results if toy have any background about it

regards

Ibrahim

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Your translation tool is making your questions very difficult to understand.

Maybe all you want is a way to calculate persistency from estimates of A, B, C. Something like:

```
proc nlin data = new outest=ESTIMATES;
parms A = 15 B = 0.19 C = -0.0012 ;
bounds A B C > 0;
by pr;
model TEST_DAY_MILK_KG = A * Time **b * exp(-C*Time);
output out = Fit predicted = Pred ;
run;
proc sql;
create table persistency as
select
pr,
A, B, C,
-(B+1)*LOG(C) as P
from ESTIMATES
where _TYPE_ = "FINAL";
select * from persistency;
quit;
```

(untested)

PG

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you PGStats very much, that is what I'm looking for exactly, and I'm sorry about the language, I Just have three years when I started to speak English. Also, I have one more question for another occasion if you don't mind

best regards

Ibrahim

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi

In this post, I'm looking for code to calculate the peak yield from this function ym = a (b/c)^(b) * e^(-b).

could you please help me with this.

regards

Ibrahim

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Just add the expression to your previous code:

```
proc sql;
create table persistency as
select
pr,
A, B, C,
-(B+1)*LOG(C) as P,
A * (B/C)**(B) * exp(-B) as peakYield
from ESTIMATES
where _TYPE_ = "FINAL";
select * from persistency;
quit;
```

(untested)

PG

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.