BookmarkSubscribeRSS Feed
tmorr
Fluorite | Level 6

hello, so my data has 4 levels and each level have 10 observation, so i would like to do the reg procedure, but when i run the code it shows that the variable is not working, i don't know why it's happened, i mean i support using the one-way ANOVA model (the factor effects model of ANOVA model I ) and it s anyone can help me with this, so appreciate.

 

DATA outdata;
INPUT Substance $ obs1-obs10;
DATALINES;
1 29 28 23 26 26 19 25 29 26 28
2 17 25 24 19 28 21 20 25 19 24
3 17 16 21 22 23 18 20 17 25 21
4 18 20 25 24 16 20 20 17 19 17
;
title "assignment1 data";

proc transpose data=outdata out=narrowdata(rename=(col1=value))
name=Dosageatdeath;
by substance;
RUN;
proc print data=narrowdata;
run;


ods graphics on;
proc reg data=outdata plots(modelLabel only)=ResidualByPredicted;
model obs=Value;
run;

2 REPLIES 2
Reeza
Super User

Post the log for starters. 

acordes
Rhodochrosite | Level 12

I suppose you want to regress substance on value. 

But you state regress obs on value. 

Furthermore you plug-in the wrong dataset to the proc reg, you should use the transposes one. 

And last but not least you carry over the sustance as char variable. proc reg can only work with numeric variables, even the clas variables on the right hand side need to be converted into dummy encoding. proc glm would be an alternative, but that's  not the case here. 

If you stick to using substance as target variable in char format then we're going to a multinomial model and proc logistic or proc genmod would be your candidate. 

 

or you use substance as numeric variable, then it works with the following code. 

DATA outdata;
INPUT Substance  obs1-obs10;
DATALINES;
1 29 28 23 26 26 19 25 29 26 28
2 17 25 24 19 28 21 20 25 19 24
3 17 16 21 22 23 18 20 17 25 21
4 18 20 25 24 16 20 20 17 19 17
;
title "assignment1 data";

proc transpose data=outdata out=narrowdata(rename=(col1=value))
name=Dosageatdeath;
by substance;
RUN;

proc print data=narrowdata;
run;



ods graphics on;
proc reg data=WORK.NARROWDATA plots(modelLabel only)=ResidualByPredicted;
model substance='value'n;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 390 views
  • 2 likes
  • 3 in conversation