wwang111 发表于 2016-10-11 17:48 
两个程序都是用0.1乘以一个字符型的变量,因为有运算符(*)的存在,所以字符型的变量会转换成数值型来计算 ...
谢谢你的回答。“什么条件下字符型变量会自动转换为数值型变量”这个问题也在困扰着我。你的回答似乎解决了我的疑问。不过昨天刚好看到sas base另一题(4th of the 70),也是字符型变量自动转换为数值型变量(日期值的"01"自动转换成了 01 ) , 但不涉你说的“运算符”。这个问题你怎么看? 谢谢。
4.The following SAS program is submitted:
data WORK.DATE_INFO;
Day="01" ;
Yr=1960 ;
X=mdy(Day,01,Yr) ;
run;
What is the value of the variable X?
A. the numeric value 0
B. the character value "01011960"
C. a missing value due to syntax errors
D. the step will not compile because of the character argument in the mdy function.
Answer: A