SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
inteli
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

4 REPLIES 4
ballardw
Super User

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;
inteli
Fluorite | Level 6

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. 

ballardw
Super User

@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.

inteli
Fluorite | Level 6

Many thanks.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 2124 views
  • 0 likes
  • 2 in conversation