@Reeza wrote:
Also, if it's 0/1 you can treat it as a categorical variable and include it in the Class statement.
Let me repeat myself.
Also, the code sample above demonstrated how to convert it to numeric.
Heres a SAS that explains it as well.
http://support.sas.com/kb/24/590.html
i have applied conversion code that you sent after that still it shows its character variable(after applying that converstion code activity do not show any erro) meanwhile i am trying to understand the link you sent.
Put the CLASS statement before the MODEL statement. That will resolve this error.
I'm having the same problem, but I'm already using proc glm.
proc glm data = cross;
model tern_co tern_cr col_L col_a col_b pH hume intra_fat rendi = sexo edad musc;
class = sexo, edad, musc;
Can I only put one variable for class? I really don't get what's wrong with it.
Here's the whole code:
data cross;
infile datalines dlm='09'x;
input sexo$ edad$ musc$ tern_co tern_cr col_L col_a col_b pH hume intra_fat rendi;
cards;
c 1 LD 4.00 1.20 28.47 19.34 17.22 5.64 73.09 1.49 51.65
c 1 LM 3.60 1.50 47.90 13.02 17.87 5.48 71.62 1.88 51.65
c 1 LD 3.90 1.20 29.57 20.11 16.55 5.49 70.33 3.94 53.16
c 1 LM 4.40 1.40 42.41 16.10 17.13 5.38 74.29 2.25 53.16
c 1 LD 6.40 1.30 33.67 13.82 10.52 5.66 70.33 3.94 51.14
c 1 LM 3.50 3.10 51.67 11.48 15.29 5.62 74.29 2.25 51.14
c 2 LD 4.00 0.80 32.35 21.36 19.52 5.51 72.44 2.32 52.56
c 2 LM 2.80 1.70 41.68 17.34 18.90 5.42 74.09 1.77 52.56
c 2 LD 2.80 1.70 34.40 15.96 11.63 5.42 72.53 2.71 51.39
c 2 LM 3.00 1.80 43.85 15.23 14.98 5.43 67.65 0.62 51.39
c 2 LD 4.20 2.10 37.96 15.01 11.91 5.61 73.74 1.35 52.38
c 2 LM 2.40 0.80 48.28 13.37 15.36 5.58 76.92 0.52 52.38
c 2 LD 2.60 1.10 36.98 20.32 19.54 5.40 71.99 3.94 51.16
c 2 LM 3.70 2.10 46.82 16.23 19.29 5.50 74.18 2.27 51.16
c 3 LD 3.80 1.10 33.16 15.43 11.33 5.97 72.59 2.72 46.08
c 3 LM 5.00 2.80 42.88 16.69 15.50 5.80 72.28 2.80 46.08
c 3 LD 5.00 1.20 34.05 16.38 11.67 5.94 69.29 3.01 53.26
c 3 LM 4.50 1.50 45.51 16.17 15.48 5.84 75.85 2.38 53.26
c 3 LD 7.70 0.60 33.44 17.43 12.74 5.96 72.81 2.74 53.25
c 3 LM 5.60 1.80 39.77 18.77 16.32 5.67 70.98 3.54 53.25
c 3 LD 6.80 1.00 33.95 15.53 11.65 5.71 75.52 2.69 50.51
c 3 LM 4.60 2.00 45.97 16.00 16.85 5.78 76.03 1.80 50.51
c 3 LD 8.20 0.90 33.79 18.33 19.79 5.90 73.31 3.23 54.61
c 3 LM 8.60 1.30 42.51 18.53 16.88 5.62 70.80 2.90 54.61
c 3 LD 7.70 5.60 33.44 17.43 12.74 5.34 72.81 2.74 51.99
c 3 LM 0.60 1.80 39.77 18.77 16.32 5.67 70.98 3.54 51.99
c 3 LD 0.90 3.90 32.26 17.96 13.32 5.66 69.66 5.35 50.97
i 3 LM 1.70 3.80 42.48 16.66 15.73 5.62 70.06 1.80 50.97
i 1 LD 4.90 1.40 29.33 20.27 17.91 5.60 72.15 1.37 53.79
i 1 LM 3.30 2.00 44.92 15.46 17.80 5.13 74.60 1.47 53.79
i 1 LD 2.60 1.60 33.22 18.53 17.29 5.55 71.58 2.17 52.71
i 1 LM 3.60 1.60 44.38 14.74 17.66 5.53 75.81 0.98 52.71
i 1 LD 5.20 1.20 38.74 17.49 15.40 5.47 74.88 0.99 55.05
i 1 LM 3.90 1.40 47.97 12.14 14.44 5.51 73.09 2.32 55.05
i 1 LD 4.50 1.30 36.49 15.43 12.05 5.49 72.73 1.69 52.44
i 1 LM 4.10 4.10 44.86 14.32 14.64 5.43 74.23 0.89 52.44
i 2 LD 7.40 1.00 35.84 21.48 19.73 5.52 71.47 3.10 48.01
i 2 LM 3.10 3.20 42.18 15.83 18.07 5.66 73.12 0.89 48.01
i 2 LD 4.70 3.20 32.12 16.24 11.50 5.54 70.20 2.06 56.11
i 2 LM 3.50 1.70 39.48 15.74 13.24 5.80 74.94 0.69 56.11
i 2 LD 1.60 1.60 27.52 12.71 11.48 5.57 72.79 2.00 52.04
i 2 LM 2.20 2.00 32.95 12.72 15.71 5.29 73.67 1.19 52.04
i 2 LD 6.60 1.80 31.88 18.85 12.78 5.47 74.86 1.13 51.90
i 2 LM 1.70 2.10 43.81 12.96 13.28 6.26 72.62 1.99 51.90
i 2 LD 4.20 1.20 33.35 15.53 11.08 5.94 75.22 1.06 55.94
i 2 LM 3.70 1.70 44.54 12.78 13.52 5.93 72.44 3.62 55.94
i 3 LD 9.60 1.30 30.95 15.13 11.43 5.92 76.41 0.48 52.74
i 3 LM 4.40 3.40 37.87 14.27 12.79 5.75 76.43 0.64 52.74
i 3 LD 6.50 1.20 33.78 18.41 13.29 6.78 75.11 1.17 56.79
i 3 LM 5.20 1.50 41.18 16.67 14.65 5.89 76.52 1.17 56.79
i 3 LD 5.80 1.20 32.89 16.03 11.48 5.87 75.46 1.20 57.22
i 3 LM 8.50 2.20 46.38 15.79 15.71 5.85 74.35 1.32 57.22
i 3 LD 5.90 0.90 30.26 15.53 10.17 5.95 73.92 1.44 56.84
i 3 LM 6.60 2.30 36.56 14.05 11.12 5.89 74.46 0.92 56.84
i 3 LD 8.50 1.30 30.27 14.22 19.76 5.22 76.41 0.48 57.32
i 3 LM 5.10 3.40 40.15 16.14 13.27 5.45 76.43 0.64 57.32
i 3 LD 7.30 0.90 33.28 15.78 10.61 5.41 74.69 1.69 53.36
i 3 LM 4.90 1.60 43.02 16.74 15.99 5.61 75.79 0.64 53.36
i 3 LD 9.70 1.10 31.73 14.19 10.61 5.86 73.94 1.90 49.49
i 3 LM 4.40 1.70 38.97 19.47 16.52 5.80 67.65 0.62 49.49
;
proc glm data = cross;
model tern_co tern_cr col_L col_a col_b pH hume intra_fat rendi = sexo edad musc;
class = sexo, edad, musc;
And here's the log:
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73
74
75
76 data cross;
77 infile datalines dlm='09'x;
78 input sexo$ edad$ musc$ tern_co tern_cr col_L col_a col_b pH hume intra_fat rendi;
79
80 cards;
NOTE: LOST CARD.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
143 ;
sexo= edad= musc= tern_co=. tern_cr=. col_L=. col_a=. col_b=. pH=. hume=. intra_fat=. rendi=. _ERROR_=1 _N_=61
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.CROSS has 60 observations and 12 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
143 ;
144 proc glm data = cross;
145
146 model tern_co tern_cr col_L col_a col_b pH hume intra_fat rendi = sexo edad musc;
ERROR: Variable sexo should be either numeric or specified in the CLASS statement.
NOTE: The previous statement has been deleted.
147 class = sexo, edad, musc;
_____
180
NOTE: The previous statement has been deleted.
ERROR 180-322: Statement is not valid or it is used out of proper order.
148
149 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
162
The CLASS statement must come before the MODEL statement, and the correct syntax is
CLASS sexo edad musc; /* no equal sign, no commas */
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.