BookmarkSubscribeRSS Feed
matteofrancioni
Calcite | Level 5

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: 

 

DateTreatmentHSR
29/03/2016A0,5
29/03/2016B0,2
29/03/2016C1,1
27/04/2016A0,2
27/04/2016B0,5
27/04/2016C0,9
10/05/2016A1,2
10/05/2016B1,1
10/05/2016C0,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!

 

 

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

ballardw
Super User

Show us the result of proc contents for data=new3.

 

matteofrancioni
Calcite | Level 5

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)

 

DatePlotCropTX
06-Jan-1513Wheat0,1
06-Jan-1515Wheat0,3
06-Jan-1517Wheat0
06-Jan-1519Corn0,1
06-Jan-1521Corn0,65
06-Jan-1523Corn0,95
06-Jan-1525Tobacco0,1
06-Jan-1527Tobacco0,1
06-Jan-1529Tobacco0
03-Apr-1513Wheat6,75
03-Apr-1515Wheat5,8
03-Apr-1517Wheat6,45
03-Apr-1519Corn6,7
03-Apr-1521Corn6,25
03-Apr-1523Corn6,3
03-Apr-1525Tobacco6,15
03-Apr-1527Tobacco5,95
03-Apr-1529Tobacco2,93

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1170 views
  • 0 likes
  • 4 in conversation