楼主: tailezhu2007
3693 7

sas的编译阶段 [推广有奖]

  • 4关注
  • 0粉丝

本科生

70%

还不是VIP/贵宾

-

威望
0
论坛币
2 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1702 点
帖子
84
精华
0
在线时间
112 小时
注册时间
2010-10-20
最后登录
2013-3-16

楼主
tailezhu2007 发表于 2012-5-26 20:20:41 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

32.Consider the following data step:

data WORK.NEW;

    set WORK.OLD;

    Count+1;

run;

The variable Count is created using a sum statement. Which statement regarding this variable is true?

     A. It is assigned a value 0 when the data step begins execution.

     B. It is assigned a value of missing when the data step begins execution.

     C. It is assigned a value 0 at compile time.

     D. It is assigned a value of missing at compile time.

Answer: C

答案说在编译阶段就给赋值为0了。可是编译阶段不是都没有值吗?

二维码

扫码加我 拉你入群

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

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

关键词:sas的 Data step EXECUTION statement following execution following regarding assigned created

回帖推荐

bobguy 发表于3楼  查看完整内容

First one needs to understand the retain statement. It is classified as non-executable statement. This is very important! count +1; is equivalent to count=count+1; retain count 0; data t1; set sashelp.class; count=count+1; retain count 0; run; proc print;run; If you assign a missing to count in retain statement, you will get all counts as missing. The other ...

本帖被以下文库推荐

沙发
tailezhu2007 发表于 2012-5-26 21:51:07
没人给说说吗?

藤椅
bobguy 发表于 2012-5-26 22:40:48
First one needs to understand the retain statement. It is classified as non-executable statement. This is very important!

count +1;

is equivalent to

count=count+1;
retain count 0;

data t1;
   set sashelp.class;
   count=count+1;
   retain count 0;
run;

proc print;run;

If you assign a missing to count in retain statement, you will get all counts as missing.


The other way to understand it is to wrap them into a do block as below,

if 0 then do;
set sashelp.class;
   count+1;
end;

As we know that every statements will not get executed at running time because ' if 0  ' is never true. In other words these statements provide information at compiling time only.  The put statement let you see what is the value of count at compiling time .  


data _null_;
  if 0 then do;
   set sashelp.class;
   count+1;
  end;
  put count;
run;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhangzachary + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

板凳
tailezhu2007 发表于 2012-5-26 23:43:13
bobguy 发表于 2012-5-26 22:40
First one needs to understand the retain statement. It is classified as non-executable statement. Th ...
Thank you very much.
就是英文能不能不这么给力啊!

报纸
tailezhu2007 发表于 2012-5-26 23:51:40

sas的编译阶段

bobguy 发表于 2012-5-26 22:40
First one needs to understand the retain statement. It is classified as non-executable statement. Th ...
捕获6.PNG
非常感谢这个大侠给的解释。解开了我的一个盲点。
自己也运行了一下程序。
确实是这样的。

地板
tailezhu2007 发表于 2012-5-27 01:01:54
bobguy 发表于 2012-5-26 22:40
First one needs to understand the retain statement. It is classified as non-executable statement. Th ...
想问你个事情,我也看了base programing
但是上面没有讲关于retain语句的是非执行语句等有关问题。
我想知道你是看的哪些方面的书,能推荐一下吗?

7
bobguy 发表于 2012-5-27 05:51:58
tailezhu2007 发表于 2012-5-27 01:01
想问你个事情,我也看了base programing
但是上面没有讲关于retain语句的是非执行语句等有关问题。
我想 ...
Unlike a executable statement, a non-executable statement only provides compiling instructions. The positions of a non-executable statement in a data step is not important. That is difference between a executable statement and a non-executable statement.

I believe that SAS base books (manual) are the best.  Beyond SAS manuals, "Professional SAS Programming Secrets" by Rick Aster is the only other book I read before. This is a really a good book.


8
dcyhfut 发表于 2012-6-8 16:51:37
bobguy 发表于 2012-5-27 05:51
Unlike a executable statement, a non-executable statement only provides compiling instructions. Th ...
大侠,能不能把Professional SAS Programming Secrets这本书传一下啊,自己找了好久没找到,chengyongdu@126.com,非常感谢

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 14:51