全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3555 13
2007-04-18

The variable attributes of SAS data sets ONE and TWO are shown below:

ONE:

# variable type len pos

2 sales num 8 8

1 year num 8 0

1 year num 8 0

TWO:

# variable type len pos

2 budget num 8 8

3 sales char 8 16

Data set ONE contains 100 observations.Data set TWO contains 50 observations.Both data sets are sorted by the variable YEAR.The following SAS program is submitted:

data three;

merge one two;

by year;

run;

which one of the following is the result of the program execution?

A.No message are written to the SAS log.

B.ERROR and WARNING messages are written to the SAS log.

C.Data set THREE is created with two variables and 50 obs.

D.Data set THREE is created with three variables and 100 obs.

Answer: B

why this program will cause error ?

3xxxxxx

二维码

扫码加我 拉你入群

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

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

全部回复
2007-4-18 20:53:00
以下是引用lqiantobe在2007-4-18 15:16:00的发言:

ONE:

# variable type len pos

2 sales num 8 8

1 year num 8 0

1 year num 8 0

TWO:

# variable type len pos

2 budget num 8 8

3 sales char 8 16

后面一行的' 1 year num 8 0' 是否应该属于变量集TWO?


给点拙见,两个变量集的sales的type不同,一个是字符,一个是数值,又没有做rename处理,如此可能变不能顺利合并。个人意见,仅供参考,还请高手指教。

[此贴子已经被作者于2007-4-18 20:57:40编辑过]

二维码

扫码加我 拉你入群

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

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

2007-4-19 06:28:00

我觉得应该是data set one的.

如果是merge by year, type的不同(num or char)应该不会出error的吧....

还得请高手指教

二维码

扫码加我 拉你入群

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

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

2007-4-19 07:38:00
以下是引用lqiantobe在2007-4-19 6:28:00的发言:

如果是merge by year, type的不同(num or char)应该不会出error的吧....

那为什么merge by year,type就可以不同呢?请指教.

二维码

扫码加我 拉你入群

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

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

2007-4-21 12:51:00

回复:(lqiantobe)[讨论]请教高手SAS EXAM 1题

should proc sort before merge
二维码

扫码加我 拉你入群

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

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

2007-4-21 13:47:00
以下是引用cattii在2007-4-21 12:51:00的发言:
should proc sort before merge

they are already sorted before merging.

二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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