全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1580 3
2013-05-03
data sales;
        do year= 1 to 1;
                do month =1 to 1;
                x+1;
                output;
                end;
                end;
run;
输出结果是一条   year  month  x
                             1        1        1

data sales;        do year= 1 to 1;                do month =1 to 1;                x+1;                                end;                end;run;输出结果是一条   year  month  x                             2        2        1为什么输出的结果不一样,能给我解释解释吗,感觉是PDV的问题。

二维码

扫码加我 拉你入群

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

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

全部回复
2013-5-3 10:16:24
Explicit output dominates the implied output at the end. Same to say, you change the position of the output statement in 2nd code. jingju
二维码

扫码加我 拉你入群

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

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

2013-5-3 13:21:39
很好解释,第一种:由于output时year 和 month都还为1;
第二种:没有output时,data语句在最后run时输出,这时do为1的情况已满足第一次循环,它将继续do赋值2时循环,发现不满足do要求,此时已经赋值为2,所以最后run
出来结果即为year=2
二维码

扫码加我 拉你入群

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

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

2013-5-3 15:43:49
使用data步的debug调试器,自己就能找到原因
复制代码
use 'step' and 'examine _all_' command to check the value of all variables
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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