BookmarkSubscribeRSS Feed
BorutK
Fluorite | Level 6

Hi guys! 

 

I came across a problem with a small sample, where we did measure the amount of fat in goat's milk during 2 year experiment (YEAR), where we took samples continuosly 5 times (SAMPLING) each year from 2 different groups (TYPE) of goats. And now we need to know if there was some kind of difference between each sampling in each year? 

 

Can somebody help me with that?

 

Thank you,

 

Here is the data:  

DATESAMPLINGYEARTYPEFAT
14.07.201511EKO2,44
14.07.201511KON2,53
12.08.201521EKO3,06
12.08.201521KON2,84
9.09.201531EKO3,19
9.09.201531KON3,14
7.10.101541EKO2,84
7.10.201541KON3,00
4.11.201551EKO3,15
4.11.201551KON3,18
8.06.201612EKO2,70
8.06.201612KON2,86
6.07.201622EKO2,85
6.07.201622KON2,61
1.08.201632EKO2,75
1.08.201632KON2,73
7.09.201642EKO2,92
7.09.201642KON2,90
5.10.201652EKO3,29
5.10.201652KON3,61
18 REPLIES 18
FredrikE
Rhodochrosite | Level 12

Do a sort by type and date, the use the lag(FAT) function to compare values between observations.

You might also need the first. function to reset figures. You need to use set by; for this to function 🙂

 

 

//Fredrik

 

BorutK
Fluorite | Level 6

Thank you for your help, but can i ask you to give me an example how to do it, step by step? 

FredrikE
Rhodochrosite | Level 12

HI!

Can you supply a data step that creates the data?

//Fredrik

BorutK
Fluorite | Level 6
Sorry i don't know what data do you mean. This data, which i paste it in first post is all i have.
FredrikE
Rhodochrosite | Level 12

Hi!

I ment the data that you posted, but I don't want to spend a lot of time just trying to create the test data set.

If you can supply that, it makes it a lot easier for me to help you 🙂

//Fredrik

BorutK
Fluorite | Level 6

Oh ok, here it is.

FredrikE
Rhodochrosite | Level 12

Thanks!

Is it the difference between samplings, i.e: between 1 and 2, 2 and 3, 3 and 4 or between sampling and year, i.e: sampling 1 year 1 and sampling 1 year2, sampling 2 year 1 and sampling 2 year2....?

//Fredrik

BorutK
Fluorite | Level 6

It should be, i would like to estimate if there is any difference between two continuos sampling in within a year and type.

FredrikE
Rhodochrosite | Level 12
proc sort data=fat;
 by type year date;
run;

data want;
 set fat;
 by type year date;

 prev_fat=lag(fat);
 diff_fat=dif(fat);

 if first.year then do;
	prev_fat = .;
	diff_fat = .;
 end;

run;

Will this work?

//Fredrik

BorutK
Fluorite | Level 6

I'm really new to those kind of procedures, so i must fill anything with before i run it?

BorutK
Fluorite | Level 6

I sorted the old data, but now i can't make a new (want) data.

BorutK
Fluorite | Level 6

Ok, i made it, but is it also possible to get if those differences are statistically different? 

FredrikE
Rhodochrosite | Level 12

Sorry, but I think that is out of my knowledge 🙂

//Fredrik

BorutK
Fluorite | Level 6
Thank you anyway, i learned couple of new things from you anyway 🙂 I tried with proc mixed and then with lsmeans but i don't think that is correct. It is really hard to work with so small number of samples.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Discussion stats
  • 18 replies
  • 2307 views
  • 2 likes
  • 4 in conversation