Hi everybody,
I really can't understand why i got this message "ERROR: Variable _29MAR2016 not found" while i'm trying to perfom a PROC GLM on my SAS University Edition. Of course I've tried to change the format of date on excel but dindn't work at all.
I need to perfom ANOVA with repeated measures in a excel databse like this one:
Date | Treatment | HSR |
29/03/2016 | A | 0,5 |
29/03/2016 | B | 0,2 |
29/03/2016 | C | 1,1 |
27/04/2016 | A | 0,2 |
27/04/2016 | B | 0,5 |
27/04/2016 | C | 0,9 |
10/05/2016 | A | 1,2 |
10/05/2016 | B | 1,1 |
10/05/2016 | C | 0,5 |
The script is the following:
PROC PRINT; RUN; data new1; set import;
keep treatment date HSR;
run;
proc sort data=new1;
by treatment;
run;
proc print;
run;
proc transpose out=New2;
by treatment;
id date;
run;
proc print;
run;
data new3; set new2;
drop _name_ _label_;
run;
proc print; run;
PROC GLM data=new3;
CLASS treatment;
title "CO2_flux";
model _29MAR2016--_10MAY2016 = treatment;
repeated time 3 (1 2 3) / summary printe;
MEANS treatment / lsd alpha=0.05; run;
Many thanks to everyone who will try to help me!
Cheers!
The model statement needs variables, not values, as arguments.
Not really familiar with proc glm myself, but my question would be why are you transposing dates up to be columns? That really doesn't sound like a good apprach.
Show us the result of proc contents for data=new3.
Ok, I think I solved this issues using this script:
PROC PRINT DATA=WORK.MYEXCEL; RUN;
PROC PRINT; RUN;
data new1; set import (rename=data=date);
keep date crop plot TX;
run;
proc print; run;
proc sort data=new1;
by crop plot;
run;
proc print; run;
proc transpose out=New2;
by crop plot;
id date;
run;
proc print; run;
data new3; set new2;
drop _name_ _label_;
run;
proc print; run;
PROC CONTENTS DATA=new3; RUN;
PROC GLM data=new3;
CLASS crop ;
title "RH";
model _06JAN2015--_28DEC2015 = crop ;
repeated time 20 (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) / summary printe;
MEANS crop / lsd alpha=0.05; run;
On a database that had 20 dates of measurements and it was structured like this (example with just 2 dates)
Date | Plot | Crop | TX |
06-Jan-15 | 13 | Wheat | 0,1 |
06-Jan-15 | 15 | Wheat | 0,3 |
06-Jan-15 | 17 | Wheat | 0 |
06-Jan-15 | 19 | Corn | 0,1 |
06-Jan-15 | 21 | Corn | 0,65 |
06-Jan-15 | 23 | Corn | 0,95 |
06-Jan-15 | 25 | Tobacco | 0,1 |
06-Jan-15 | 27 | Tobacco | 0,1 |
06-Jan-15 | 29 | Tobacco | 0 |
03-Apr-15 | 13 | Wheat | 6,75 |
03-Apr-15 | 15 | Wheat | 5,8 |
03-Apr-15 | 17 | Wheat | 6,45 |
03-Apr-15 | 19 | Corn | 6,7 |
03-Apr-15 | 21 | Corn | 6,25 |
03-Apr-15 | 23 | Corn | 6,3 |
03-Apr-15 | 25 | Tobacco | 6,15 |
03-Apr-15 | 27 | Tobacco | 5,95 |
03-Apr-15 | 29 | Tobacco | 2,93 |
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.