BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Chiaoyi
Calcite | Level 5

My codes are:

DATA Ch2_14; 

INPUT ratio $ viscosity; 

CARDS; 

1.0 0.45 

0.9 0.20 

0.8 0.34 

0.7 0.58 

0.6 0.70 

0.5 0.57 

0.4 0.55 

0.3 0.44 

; 

RUN; 

proc Reg data = CH2_14;
	model  ratio = viscosity;
 run;

ERROR: Variable ratio in list does not match type prescribed for this list.

How to fix my code?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Ratio is a character variable, as seen by the $ when you INPUT ratio. You can't perform a linear regression on character variables.

 

Remove the $ and try your code again.

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Ratio is a character variable, as seen by the $ when you INPUT ratio. You can't perform a linear regression on character variables.

 

Remove the $ and try your code again.

--
Paige Miller
data_null__
Jade | Level 19
Get rid of the $sign in the INPUT statement.
Reeza
Super User
You're reading in Ratio with a $ which means SAS will read that in as a character variable. SAS will not use character variables in regression because that doesn't make sense. Remove the $ to read it in as a numeric and you should be fine.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 679 views
  • 5 likes
  • 4 in conversation