标题: 结果为空 [打印本页] 作者: shiyiming 时间: 2007-6-27 16:07 标题: 结果为空 [code:21e28]data temp;
input a $1 b $2;
put a b;
cards;
1 2
;
run;
data tmp;
set temp;
a=input(a,8.)+input(b,8.);
put a;
run;[/code:21e28]
这个结果为什么是空的而不是1呢
1加空 为什么等于空呢 如何才能让他等于1呢作者: shiyiming 时间: 2007-6-27 21:56 标题: Re: 结果为空 [code:766e1]data temp;
input a$1 b$1;
put a b;
cards;
1 2
;
run;
data tmp;
set temp;
a=input(a,8.)+input(b,8.);
put a;
run;[/code:766e1]作者: shiyiming 时间: 2007-6-28 10:27 标题: Re: 结果为空 Hi,
You should know the difference of concepts: "column input" and "formatted input".
Obviously, you have misunderstood them.
Please see the codes below:
[code:c44e5]data temp;
input a $1 b $3; /* column input, equivalent to "input a $ 1 b $ 3;" */
put a b;
cards;
1 2
;
run;
data tmp;
set temp;
a=input(a,8.)+input(b,8.);
put a;
run;
data temp;
input a $1. +1 b $1.; /* formatted input */
put a b;
cards;
1 2
;
run;
data tmp;
set temp;
a=input(a,8.)+input(b,8.);
put a;
run;[/code:c44e5]