全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2178 2
2013-10-26
对于character variable 来说, the length of a variable always define automatically in the first statement and remain unchanged during the whole program until and unless we redefine it. 按照这个说法,为什么123题中的第64题答案是A不是12。虽然说work department的data set中character variable的length是5,可是在程序中有“length jobcode$ 12”的语句,不就等于重新redefine了吗?那么答案不应该是12吗?

The following SAS DATA step is submitted:
data work.accountting;
set work.department;
length jobcode$ 12;
run;
The WORK.DEPARTMENT SAS data set contains a character variable named
JOBCODE with a length of 5.
Which one of the following is the length of the variable JOBCODE in the output
data set?
A. 5
B. 8
C. 12
D. The length can not be determined as the program fails to execute due to errors.



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-10-26 21:18:40
D 好像定义长度的时候字符型和数值型都只能制定长度,字符型变量不能加$
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-10-27 21:53:19
SAS compiler uses first in first out rule.

set statement is before the length statement. So for any variables defined in a length statement is also on the data set,
1) sas use the length definition on that data set if a variable type is the same
2) issue error message if if a variable type is different.

You can see the difference if you put the length statement before  the set  statement.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群