Dear Friends,
As a brief;
We have 2 groups of dairy cows (n=18). Before performing this experiment, we fed the cows with the same ration and collected the data (this period of time called "the covariate period").
then we fed the cows with two types of diet.
We have data from the covariate period (these type of data mentioned by "_b") and experimental period.
When I run the SAS, it doesn't work and there isn't any comparison between groups. Please let me know how to solve this problem. Thank you very much in advance.
- ruminate time (RT_b), eat time (ET_b), total chewing time (TCHT_b), ruminate chews per minute (RCHM_b) (belong to the covariate period)
- ruminate time (RT), eat time (ET), total chewing time (TCHT), ruminate chews per minute (RCHM)
(belong to the experimental period)
data chewing_activity;
input number cow$ day group period RT RT_b ET ET_b TCHT TCHT_b RCHM RCHM_b;
cards;
2 Kiana 1 1 1 . 512.3333333 . 234.75 . 747.0833333 . 55.34738343
2 Kiana 2 1 1 . 557.6 . 238.55 . 796.15 . 54.74111311
2 Kiana 3 1 1 . 606.1666667 . 272.25 . 878.4166667 . 59.57216973
2 Kiana 4 1 1 . 573.4333333 . 185.9 . 759.3333333 . 55.16165784
2 Kiana 1 1 2 492.7333333 . 326.3833333 . 819.1166667 . 47.30783116 .
2 Kiana 2 1 2 532.7333333 . 331.3333333 . 864.0666667 . 52.69506034 .
2 Kiana 3 1 2 521.7666667 . 472.65 . 994.4166667 . 45.84151376 .
2 Kiana 4 1 2 523.3666667 . 423.7166667 . 947.0833333 . 51.3313237 .
2 Kiana 5 1 2 477.3333333 . 382.5333333 . 859.8666667 . 47.34758557 .
2 Kiana 6 1 2 512.65 . 317.6833333 . 830.3333333 . 52.77629327 .
4 Babsi 1 1 1 . 428.25 . 307.6833333 . 735.9333333 . 61.80116452
4 Babsi 2 1 1 . 567.3 . 397.55 . 964.85 . 70.08634798
4 Babsi 3 1 1 . 567.3 . 397.55 . 964.85 . 70.08634798
4 Babsi 4 1 1 . 592.5833333 . 414.9833333 . 1007.566667 . 70.57354719
4 Babsi 5 1 1 . 538.1333333 . 409.6 . 947.7333333 . 60.40886667
4 Babsi 6 1 1 . 498.4166667 . 309.9833333 . 808.4 . 62.34132099
4 Babsi 1 1 2 557.65 . 434.1333333 . 991.7833333 . 66.3044317 .
4 Babsi 2 1 2 557.3666667 . 462.75 . 1020.116667 . 63.81566003 .
4 Babsi 3 1 2 561.7 . 474.7666667 . 1036.466667 . 67.37844384 .
4 Babsi 4 1 2 586.8666667 . 477.7333333 . 1064.6 . 64.15612407 .
4 Babsi 5 1 2 564.45 . 495.5166667 . 1059.966667 . 56.39883101 .
4 Babsi 6 1 2 578.7166667 . 516.0166667 . 1094.733333 . 66.72323661 .
4 Babsi 7 1 2 525.4666667 . 467.9 . 993.3666667 . 61.95853382 .
5 Utah 1 1 1 . 493.3666667 . 429.5666667 . 922.9333333 . 51.67507344
5 Utah 2 1 1 . 495.3166667 . 438.3166667 . 933.6333333 . 60.62639537
5 Utah 1 1 2 551.5666667 . 448.45 . 1000.016667 . 61.2348648 .
5 Utah 2 1 2 603.7833333 . 411.1 . 1014.883333 . 49.29806239 .
5 Utah 3 1 2 620.8333333 . 456.1 . 1076.933333 . 58.87556313 .
5 Utah 4 1 2 667.9333333 . 416.55 . 1084.483333 . 56.22695833 .
5 Utah 5 1 2 548.35 . 473.1 . 1021.45 . 51.93406544 .
6 Uruguay 1 1 1 . 479.65 . 146.8833333 . 626.5333333 . 43.94994822
6 Uruguay 2 1 1 . 648.4833333 . 180.5666667 . 829.05 . 60.75618736
6 Uruguay 3 1 1 . 667.55 . 222.9 . 890.45 . 57.9373914
6 Uruguay 4 1 1 . 680.9333333 . 171.8166667 . 852.75 . 54.65156298
6 Uruguay 5 1 1 . 683.1333333 . 162.2333333 . 845.3666667 . 60.11519972
6 Uruguay 1 1 2 561.1666667 . 183.3166667 . 744.4833333 . 49.88612559 .
6 Uruguay 2 1 2 528.5333333 . 235.7 . 764.2333333 . 50.49635057 .
6 Uruguay 3 1 2 657.1666667 . 215.4 . 872.5666667 . 52.63726854 .
6 Uruguay 4 1 2 560.9833333 . 234.45 . 795.4333333 . 44.94629113 .
6 Uruguay 5 1 2 589.6166667 . 246.6666667 . 836.2833333 . 47.14744105 .
6 Uruguay 6 1 2 451.1166667 . 180.1666667 . 631.2833333 . 43.76234594 .
6 Uruguay 7 1 2 628.0833333 . 192.65 . 820.7333333 . 50.16394515 .
7 Polli 1 1 1 . 421.9333333 . 239.6833333 . 661.6166667 . 52.45664704
7 Polli 2 1 1 . 306.05 . 214 . 520.05 . 41.65148584
7 Polli 3 1 1 . 214.8 . 279.0833333 . 493.8833333 . 36.05314396
7 Polli 1 1 2 432.85 . 215.2833333 . 648.1333333 . 44.76571528 .
7 Polli 2 1 2 464.3166667 . 253.9166667 . 718.2333333 . 43.96608199 .
7 Polli 3 1 2 434.15 . 235.3333333 . 669.4833333 . 49.66014363 .
7 Polli 4 1 2 529.6166667 . 222.5666667 . 752.1833333 . 47.06875638 .
7 Polli 5 1 2 524.15 . 263.0666667 . 787.2166667 . 46.89190669 .
15 Jasmin 1 1 2 537.6666667 . 385.1333333 . 922.8 . 52.12378359 .
15 Jasmin 2 1 2 497.1833333 . 491.7166667 . 988.9 . 52.37709988 .
15 Jasmin 3 1 2 513.75 . 493.5166667 . 1007.266667 . 46.73807288 .
15 Jasmin 4 1 2 564.3333333 . 456.8 . 1021.133333 . 52.33929737 .
15 Jasmin 5 1 2 545.9 . 494.25 . 1040.15 . 49.32894535 .
15 Jasmin 6 1 2 528.1833333 . 509.0333333 . 1037.216667 . 52.22517912 .
15 Jasmin 7 1 2 528.0666667 . 442.1166667 . 970.1833333 . 57.7972506 .
17 Prima 1 1 1 . 448.9166667 . 197.5666667 . 646.4833333 . 57.22526267
17 Prima 2 1 1 . 550.4666667 . 209.9 . 760.3666667 . 57.718887
17 Prima 3 1 1 . 518.1833333 . 210.45 . 728.6333333 . 59.95986008
17 Prima 4 1 1 . 496.2166667 . 171.1 . 667.3166667 . 55.41500878
17 Prima 5 1 1 . 520.1166667 . 171.8833333 . 692 . 56.6875585
17 Prima 1 1 2 508.9 . 512.25 . 1021.15 . 63.60068316 .
17 Prima 2 1 2 521.4166667 . 390.5 . 911.9166667 . 55.55684354 .
17 Prima 3 1 2 521.9833333 . 579.5666667 . 1101.55 . 48.84366637 .
17 Prima 4 1 2 516.8833333 . 563.4 . 1080.283333 . 54.65540137 .
17 Prima 5 1 2 558.0666667 . 576.4833333 . 1134.55 . 58.49746854 .
17 Prima 6 1 2 510.6333333 . 525.4833333 . 1036.116667 . 60.81877636 .
25 Zoey 1 1 2 455.9833333 . 461.8333333 . 917.8166667 . 49.26593889 .
25 Zoey 2 1 2 441.85 . 505.6833333 . 947.5333333 . 48.89141876 .
25 Zoey 3 1 2 533.8333333 . 446.8666667 . 980.7 . 53.3089167 .
25 Zoey 4 1 2 473.9 . 473.0333333 . 946.9333333 . 59.43585057 .
25 Zoey 5 1 2 429.4166667 . 567 . 996.4166667 . 44.65467024 .
25 Zoey 6 1 2 510.1833333 . 421.0166667 . 931.2 . 58.39603725 .
26 Anna 1 1 1 . 592.8166667 . 328.95 . 921.7666667 . 74.45351708
26 Anna 2 1 1 . 530.55 . 345.15 . 875.7 . 68.12604705
26 Anna 1 1 2 605.6 . 299.9166667 . 905.5166667 . 69.98385318 .
26 Anna 2 1 2 620.1666667 . 336.9 . 957.0666667 . 79.79039647 .
26 Anna 3 1 2 580.7833333 . 399.5333333 . 980.3166667 . 63.60419964 .
26 Anna 4 1 2 599.95 . 425.1666667 . 1025.116667 . 66.29044932 .
26 Anna 5 1 2 534.8833333 . 306.2833333 . 841.1666667 . 68.96244077 .
26 Anna 6 1 2 594.2 . 422.3666667 . 1016.566667 . 60.52436068 .
1 Berta 1 2 2 464.6333333 . 288.95 . 753.5833333 . 44.22059175 .
1 Berta 2 2 2 558.3833333 . 377 . 935.3833333 . 47.83070913 .
1 Berta 3 2 2 514.25 . 381.8166667 . 896.0666667 . 45.70116516 .
1 Berta 4 2 2 519.2 . 425.55 . 944.75 . 53.16688697 .
1 Berta 5 2 2 505.7666667 . 330.1333333 . 835.9 . 47.97374403 .
1 Berta 6 2 2 519.9166667 . 300.3166667 . 820.2333333 . 51.61180604 .
10 Bella 1 2 1 . 539.95 . 455.3166667 . 995.2666667 . 55.27394252
10 Bella 2 2 1 . 565.1 . 435.9 . 1001 . 64.04556661
10 Bella 3 2 1 . 539.6333333 . 444.75 . 984.3833333 . 57.02510636
10 Bella 4 2 1 . 529.9 . 416.4166667 . 946.3166667 . 60.53788283
10 Bella 5 2 1 . 577.4166667 . 407.0833333 . 984.5 . 63.41081827
10 Bella 1 2 2 527.6166667 . 299.6166667 . 827.2333333 . 53.32722082 .
10 Bella 2 2 2 512.05 . 453.7 . 965.75 . 49.39574692 .
10 Bella 3 2 2 575.6166667 . 420.4333333 . 996.05 . 53.66446437 .
10 Bella 4 2 2 534.1166667 . 466.8166667 . 1000.933333 . 61.3771341 .
10 Bella 5 2 2 539.3833333 . 475.7166667 . 1015.1 . 52.48053657 .
10 Bella 6 2 2 525.7 . 381.85 . 907.55 . 53.41685304 .
10 Bella 7 2 2 545.4166667 . 332.2833333 . 877.7 . 55.94222306 .
12 Mala 1 2 1 . 456.2833333 . 358.05 . 814.3333333 . 57.85050974
12 Mala 2 2 1 . 606.7 . 393.2333333 . 999.9333333 . 74.71412902
12 Mala 3 2 1 . 580.6 . 444.5166667 . 1025.116667 . 75.03692419
12 Mala 4 2 1 . 538.9333333 . 372.2 . 911.1333333 . 65.26086467
12 Mala 1 2 2 529.0333333 . 311.3666667 . 840.4 . 56.40510195 .
12 Mala 2 2 2 605.9166667 . 355.3833333 . 961.3 . 70.58063955 .
12 Mala 3 2 2 548.45 . 436.5333333 . 984.9833333 . 61.15737952 .
12 Mala 4 2 2 592.3 . 396.9166667 . 989.2166667 . 70.9370578 .
12 Mala 5 2 2 580.0333333 . 411.9833333 . 992.0166667 . 64.64852499 .
12 Mala 6 2 2 588.6333333 . 339.1166667 . 927.75 . 76.70612535 .
12 Mala 7 2 2 567.2666667 . 356.9333333 . 924.2 . 64.24325202 .
14 Wendy 1 2 1 . 420.8666667 . 276.4166667 . 697.2833333 . 46.4886524
14 Wendy 2 2 1 . 586.95 . 349.7333333 . 936.6833333 . 68.89152397
14 Wendy 3 2 1 . 573.2666667 . 392.8 . 966.0666667 . 68.45728115
14 Wendy 4 2 1 . 534.65 . 363.15 . 897.8 . 62.34161347
14 Wendy 1 2 2 567.85 . 270.8666667 . 838.7166667 . 67.71210582 .
14 Wendy 2 2 2 614.1833333 . 359.0166667 . 973.2 . 68.31493023 .
14 Wendy 3 2 2 570.2 . 388.8 . 959 . 61.8021809 .
14 Wendy 4 2 2 598.7666667 . 370.8333333 . 969.6 . 61.91680676 .
14 Wendy 5 2 2 541.5333333 . 387.0166667 . 928.55 . 58.36183593 .
14 Wendy 6 2 2 537.3166667 . 264.7166667 . 802.0333333 . 60.74976394 .
18 Mona 1 2 1 . 430.4166667 . 300.0833333 . 730.5 . 56.42095517
18 Mona 2 2 1 . 577.9166667 . 402.0333333 . 979.95 . 70.58160215
18 Mona 3 2 1 . 633.4666667 . 332.7 . 966.1666667 . 63.35349864
18 Mona 4 2 1 . 635.35 . 378.65 . 1014 . 73.06776137
18 Mona 5 2 1 . 578.2833333 . 353.4 . 931.6833333 . 70.91449122
18 Mona 1 2 2 525.1666667 . 222.5666667 . 747.7333333 . 57.34038904 .
18 Mona 2 2 2 538.7 . 346.0666667 . 884.7666667 . 65.59850623 .
18 Mona 3 2 2 527.0833333 . 242.0333333 . 769.1166667 . 65.87139777 .
18 Mona 4 2 2 576.3833333 . 360.95 . 937.3333333 . 65.70578995 .
18 Mona 5 2 2 513.7166667 . 298.05 . 811.7666667 . 53.351871 .
21 Peggy 1 2 1 . 453.7333333 . 347.95 . 801.6833333 . 42.4785217
21 Peggy 2 2 1 . 572.6 . 458.1833333 . 1030.783333 . 66.99416222
21 Peggy 3 2 1 . 600.8 . 401.6166667 . 1002.416667 . 64.4804091
21 Peggy 4 2 1 . 560.2166667 . 476.95 . 1037.166667 . 61.46637467
21 Peggy 5 2 1 . 617.8166667 . 417.9 . 1035.716667 . 58.71163484
21 Peggy 1 2 2 542.05 . 361.0833333 . 903.1333333 . 53.62656543 .
21 Peggy 2 2 2 578.75 . 462.3 . 1041.05 . 46.93243105 .
21 Peggy 3 2 2 563.0666667 . 566.15 . 1129.216667 . 57.89051104 .
21 Peggy 4 2 2 647.3166667 . 488.3833333 . 1135.7 . 52.34408605 .
21 Peggy 5 2 2 552.35 . 468.6333333 . 1020.983333 . 54.39336948 .
21 Peggy 6 2 2 605.7833333 . 377.4666667 . 983.25 . 61.77809066 .
21 Peggy 7 2 2 529.7833333 . 398.3666667 . 928.15 . 49.53884953 .
22 Panama 1 2 1 . 355.95 . 410.6833333 . 766.6333333 . 46.35990943
22 Panama 2 2 1 . 508.4 . 414.6333333 . 923.0333333 . 65.97906
22 Panama 3 2 1 . 544.1666667 . 473.7 . 1017.866667 . 59.46189645
22 Panama 4 2 1 . 578.25 . 391.25 . 969.5 . 74.8761149
22 Panama 5 2 1 . 580.0166667 . 418.4333333 . 998.45 . 68.02689378
22 Panama 1 2 2 557.1166667 . 340.3666667 . 897.4833333 . 58.26238501 .
22 Panama 2 2 2 553.25 . 459.2333333 . 1012.483333 . 58.44362187 .
22 Panama 3 2 2 551.9 . 496.2333333 . 1048.133333 . 55.81435611 .
22 Panama 4 2 2 544.25 . 462.55 . 1006.8 . 68.3724288 .
22 Panama 5 2 2 512.4166667 . 424.85 . 937.2666667 . 59.52049504 .
22 Panama 6 2 2 570.8833333 . 350.4666667 . 921.35 . 62.24124437 .
22 Panama 7 2 2 428.3333333 . 250.85 . 679.1833333 . 49.72991708 .
23 Isa 1 2 2 511.15 . 238.1666667 . 749.3166667 . 55.82450246 .
23 Isa 2 2 2 655.5333333 . 301.45 . 956.9833333 . 63.42457437 .
23 Isa 3 2 2 468.3833333 . 277.1666667 . 745.55 . 56.8581982 .
23 Isa 4 2 2 645.8166667 . 293.7666667 . 939.5833333 . 63.42838131 .
23 Isa 5 2 2 596.35 . 315.35 . 911.7 . 67.28577052 .
23 Isa 6 2 2 602.7333333 . 258.95 . 861.6833333 . 69.87836376 .
23 Isa 7 2 2 496.6666667 . 232.7333333 . 729.4 . 60.12410743 .
24 Bianca 1 2 1 . 487.5333333 . 368.15 . 855.6833333 . 48.78756598
24 Bianca 2 2 1 . 514.5166667 . 480.7333333 . 995.25 . 51.76566887
24 Bianca 3 2 1 . 516.0333333 . 445.5166667 . 961.55 . 56.86901512
24 Bianca 4 2 1 . 514.8833333 . 387.35 . 902.2333333 . 56.0037657
24 Bianca 1 2 2 492.7333333 . 326.3833333 . 819.1166667 . 47.30783116 .
24 Bianca 2 2 2 532.7333333 . 331.3333333 . 864.0666667 . 52.69506034 .
24 Bianca 3 2 2 521.7666667 . 472.65 . 994.4166667 . 45.84151376 .
24 Bianca 4 2 2 523.3666667 . 423.7166667 . 947.0833333 . 51.3313237 .
24 Bianca 5 2 2 477.3333333 . 382.5333333 . 859.8666667 . 47.34758557 .
24 Bianca 6 2 2 512.65 . 317.6833333 . 830.3333333 . 52.77629327 .
;
proc mixed data= chewing_activity;
class day cow group period;
model RT= RT_b group;
random cow(group*period)/ type=vc;
repeated day/ subject=cow(group) type=ar(1);
lsmeans group / CL pdiff adjust=tukey CORR ;
run;
proc mixed data= chewing_activity;
class day cow group period;
model ET= ET_b group;
random cow(group*period)/ type=vc;
repeated day/ subject=cow(group) type=ar(1);
lsmeans group / CL pdiff adjust=tukey CORR ;
run;
proc mixed data= chewing_activity;
class day cow group period;
model TCHT= TCHT_b group;
random cow(group*period)/ type=vc;
repeated day/ subject=cow(group) type=ar(1);
lsmeans group / CL pdiff adjust=tukey CORR ;
run;
proc mixed data= chewing_activity;
class day cow group period;
model RCHM= RCHM_b group;
random cow(group*period)/ type=vc;
repeated day/ subject=cow(group) type=ar(1);
lsmeans group / CL pdiff adjust=tukey CORR ;
run;
This is the edited message according to dear Paige Miller advice. Thank you Paige Miller.
Please read the log. It says:
436 data chewing_activity; 437 input number cow$ day group period R.T R.T_b E.T E.T_b T.CH.T T.CH.T_b R.CH.M R.CH.M_b; --- 557 ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase. ERROR 557-185: Variable R is not an object. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
Variable names are not allowed to have dots in the variable name.
Dear Paige Miller,
Thanks for your quick reply. I changed the names but still doesn't have any results.
Cheers,
Mansour
For your future benefit, as well as for use in this thread, when you say something doesn't work, and then provide no other information, we can't help you.
However, if something doesn't work and you SHOW US what you did (the code) and the part that doesn't work — the entire log for the step that doesn't work, or if the output is the incorrect output and explain what is wrong, then it is much more likely that we can help you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.