DATA Step, Macro, Functions and more

How to perform anova on imported xls dataset

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

How to perform anova on imported xls dataset

Please can someone help? I have been trying to perform anova on the attached imported data from excel but unsuccessful.

After importing the table into SAS data set and using the script below:

 

proc anova data=race1.sr2013;
class maxT;
model Res=maxT;
run;

 

The result does not give the F value neither the Pr>F values

I tried running

 

data race1.sr2013;
do maxT = 1 to 7;
do i = 1 to 7;
input RES @@@; output; end; end; cards;
proc anova; class maxT; model RES=maxT; means maxT/LSD; run;

 

Yet this deletes the data from the SAS table with the log massage:

NOTE: The data set GRACE1.SR2015 has 0 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds

 

I am learning SAS and any assistance would be appreciated.


Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 13,876

Re: How to perform anova on imported xls dataset

Post code into a code box opened using the forums {I}.

Include the lines of data following the cards; statement through the ending ;

If you didn't have any data then that is an issue: there was nothing for the INPUT to read.

 

Your example data does not have any repeat values for the maxT variable. So there is no variability in the dependent variable based on the independent variable for the F statistic to use.

Try this as an example where I have edited the maxT value for Jul-13 to match Jun-13.

data work.sr2013;
input MONTHS $	RF	maxT	minT	ST	Res;
datalines;
Jun-13	13.97	31.60	23.40	15.87	5.43
Jul-13	9.77	31.60	23.06	26.88	8.52
Aug-13	11.77	29.29	23.03	26.77	8.47
Sep-13	12.87	30.37	23.03	27.33	8.75
Oct-13	12.98	31.35	22.71	28.18	9.18
Nov-13	43.08	32.13	22.87	29.28	9.76
Dec-13	9.33	32.16	20.66	28.02	9.11
;
run;


proc anova data=work.sr2013;
class maxT ;
model Res=maxT ;
run;

View solution in original post


All Replies
Solution
3 weeks ago
Super User
Posts: 13,876

Re: How to perform anova on imported xls dataset

Post code into a code box opened using the forums {I}.

Include the lines of data following the cards; statement through the ending ;

If you didn't have any data then that is an issue: there was nothing for the INPUT to read.

 

Your example data does not have any repeat values for the maxT variable. So there is no variability in the dependent variable based on the independent variable for the F statistic to use.

Try this as an example where I have edited the maxT value for Jul-13 to match Jun-13.

data work.sr2013;
input MONTHS $	RF	maxT	minT	ST	Res;
datalines;
Jun-13	13.97	31.60	23.40	15.87	5.43
Jul-13	9.77	31.60	23.06	26.88	8.52
Aug-13	11.77	29.29	23.03	26.77	8.47
Sep-13	12.87	30.37	23.03	27.33	8.75
Oct-13	12.98	31.35	22.71	28.18	9.18
Nov-13	43.08	32.13	22.87	29.28	9.76
Dec-13	9.33	32.16	20.66	28.02	9.11
;
run;


proc anova data=work.sr2013;
class maxT ;
model Res=maxT ;
run;
Occasional Contributor
Posts: 5

Re: How to perform anova on imported xls dataset

Thank you for the advice and help.

Please one more, how do I add more independent variable  to the code (like the rest of RF, minT, maxT, and ST) to evalute all at once.

Thank you in advance. 

Super User
Posts: 13,876

Re: How to perform anova on imported xls dataset

[ Edited ]

@inteli wrote:

Thank you for the advice and help.

Please one more, how do I add more independent variable  to the code (like the rest of RF, minT, maxT, and ST) to evalute all at once.

Thank you in advance. 


Basic is just to list them:  model ref= maxT mint st rt;

That is a "main effects" model where none of the potential interactions are considered. Interactions are indicated with an *.

 

model ref= maxT mint st rt  maxt*mint ;

would consider the interaction of maxt and mint. Any variables that might interact could be indicated. You can have multiple levels of interaction: model ref= maxT mint st rt maxt*mint*st ; for instance.

This is not a trivial question. The syntax can get a bit confusing as to what is meant by combinations of * () and the | symbol. Check your online documentation for Proc Anova model statement. There should be a link to "specification of effects" to go through more combinations.

Occasional Contributor
Posts: 5

Re: How to perform anova on imported xls dataset

Many thanks.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 94 views
  • 0 likes
  • 2 in conversation