标题: 问个关于length的问题 [打印本页] 作者: shiyiming 时间: 2010-5-24 14:08 标题: 问个关于length的问题 question:
The following SAS program is submitted:
data work.month;
date = input('13mar2000',date9.);
run;
Which one of the following represents the type and length of the variable DATE in
the output data set?
A. numeric, 8 bytes
B. numeric, 9 bytes
C. character, 8 bytes
D. character, 9 bytes
------------------------------
In sas system:
data work.month;
date = input('13mar2000',date9.);
length=length(date);
put _all_;
run;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
1139:15
date=14682 length=12 _ERROR_=0 _N_=1作者: shiyiming 时间: 2010-5-24 16:26 标题: Re: 问个关于length的问题 1、为了便于数值间的计算,SAS里的date,time,datetime都是以numeric的类型来存储的;而在SAS里numeric的存储长度固定的就是8bytes
2、length()函数的argument只接受character,而date变量是numeric的,因此SAS做了自动的类型转换,使用了默认的输出格式best12.,于是length就等于12了作者: shiyiming 时间: 2010-5-30 11:09 标题: Re: 问个关于length的问题 说的很对