BookmarkSubscribeRSS Feed
Rodolfo_Mingoti
Fluorite | Level 6

Hello, I would like to help for analyzing of database in dairy farms (Longitudinal analysis).

 

In my database, I have daily milk production for 115 days. However, some cows stop producing milk at 20d, 35d, 80 days (random days). Therefore, as time go on, naturally the cows production less milk until to stop completely the milk prodution.

 

Ex: On the first day I have 1000 cows producing milk. At the end of the 115 days, only 150 cows remain producing milk.

 

My greatest doubt occurs when an animal stops producing milk. As the cows are removed of the database (cows stop producing milk) the average from this moment changes (increases) causing to curve error (because the cows less productive stop the production).

 

How can I solve it?

 

 

PROC GLIMMIX DATA=Dairy.Cows;
	CLASS ID Group Time;
		MODEL MilkProduction = Group Time Group*Time / DDFM=KENWARDROGER DIST=GAUSSIAN ;
			RANDOM Time / RESIDUAL TYPE=UN SUBJECT=ID(Group);
RUN;

Data_Base.JPG

 

2 REPLIES 2
Norman21
Lapis Lazuli | Level 10

It looks like you might need a "time to failure" analysis, described in some detail here:

 

https://stats.idre.ucla.edu/sas/seminars/sas-survival/

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

Rodolfo_Mingoti
Fluorite | Level 6

Hello Norman21, firstly thanks for your attention. I saw your recommendation about survival analysis using Proc Lifetest but unfortunately, that procedure is not that I need.

 

The topic listed is very close to what I need, but do not have the solution yet: https://communities.sas.com/t5/Statistical-Procedures/Using-PROC-NLIN-to-fit-curves-for-dairy-cattle...

 

In my database, after the middle of lactation the numbers of cows decrease. The begin of lactation (day 1) I have 1000 observations (cows) and the end of lactation (day 115) I have only 150 observations. The response variable is milk_production (continuous variable).

Some people said that I can not compare the groups, because I have not completed basedata. The solution for that is filter the dataset just for animal that have complete lactation. Using this methodology, I will lose information about 750 cows.

 

My doubt is: Are there another way to solve it?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1185 views
  • 0 likes
  • 2 in conversation