DATA Step, Macro, Functions and more

ERROR: Variable _29MAR2016 not found

Reply
New Contributor
Posts: 2

ERROR: Variable _29MAR2016 not found

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!

 

 

Super User
Posts: 7,761

Re: ERROR: Variable _29MAR2016 not found

Posted in reply to matteofrancioni

The model statement needs variables, not values, as arguments.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,942

Re: ERROR: Variable _29MAR2016 not found

Posted in reply to matteofrancioni

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.

Super User
Posts: 11,343

Re: ERROR: Variable _29MAR2016 not found

Posted in reply to matteofrancioni

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

 

New Contributor
Posts: 2

Re: ERROR: Variable _29MAR2016 not found

Posted in reply to matteofrancioni

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
Ask a Question
Discussion stats
  • 4 replies
  • 190 views
  • 0 likes
  • 4 in conversation