全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4385 6
2007-07-10
谢谢大家了,明天就考了.

1.这题我一直不太明白什么时候用INDEX?为什么后面2个WHERE的不可以

The SAS data set SASDATA.SALES has a simple index on the variable DATE and a variable
named REVENUE with no index.
In which one of the following SAS programs is the DATE index considered for use?
proc print data = sasdata.sales;
by date;
run;
proc print data = sasdata.sales;
where month(date) = 3;
run;
data march;
set sasdata.sales;
if '01mar2002'd < date < '31mar2002'd;
run;
data march;
set sasdata.sales;
where date < '31mar2002'd or revenue > 50000;
run;
correct_answer = "A"


2.这题的大小写有什么区别呢


The following SAS code is submitted:

%macro houses(dsn = houses,sub = RANCH);

data &dsn;

set sasuser.houses; if style = "&sub";

run;

%mend;

%houses(sub = SPLIT)

%houses(dsn = ranch)

%houses(sub = TWOSTORY)

Which one of the following is the value of the automatic macro variable SYSLAST?



A. work.ranch

B. work.houses

C. WORK.RANCH

D. WORK.HOUSES



Answer: D



3为什么是C不是D

Given the following SAS statement:

%let idcode = Prod567;

Which one of the following statements stores the value 567 in the macro variable CODENUM?



A. %let codenum = substr(&idcode,length(&idcode)-2);

B. %let codenum = substr(&idcode,length(&idcode)-3);

C. %let codenum = %substr(&idcode,%length(&idcode)-2);

D. %let codenum = %substr(&idcode,%length(&idcode)-3);
二维码

扫码加我 拉你入群

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

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

全部回复
2007-7-10 09:10:00

Questions 1:

SAS determine when to use index , it has these definition:

Determining Whether SAS Is Using an Index

It is not always possible or more efficient for SAS to use an existing index to access specific observations directly. An index is not used

  • with a subsetting IF statement in a DATA step
  • with particular WHERE expressions
  • if SAS determines it is more efficient to read the data sequentially.

So the both where statements reads most of the observations of datasets, using index is not efficient. So A is the better answer.

Q2:

Not quiet sure, but when you try to find the match name to automatic variables, you always need the exactly upper case, lower case does not match. That’s what I’m understanding, let you know if finding better answer.

Q3:

If you know how to use substr() function, you won’t think D is correct answer.

%substr(&idcode,%length(&idcode)-2),

let’s see:

&idcode resolves to Prod567,

length(&idcode) = length(Prod567) = 7, so far, you ok?

So 7-2 = 5;

Next, we need to know how to use substr() function: Substr(var, start_postion).

Then %substr(&idcode,%length(&idcode)-2) = %substr(Prod567, 5) = 567.

If answer is D, so length(&idcode)-3 = 7 – 3 =4;

%substr(Prod567, 4) = d567;

Hope this helps and will be glade to hear your news after you test!

[此贴子已经被作者于2007-7-10 9:33:12编辑过]

二维码

扫码加我 拉你入群

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

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

2007-7-10 10:52:00

回复:(bbcc3675)求助 问几道ADV的题,明天就考试了

Q2: all values of SAS automatic variables are in capital letter. They just want to test if you know that.
二维码

扫码加我 拉你入群

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

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

2007-7-10 12:40:00

Q1: why the two where statement did not work:

* SAS does not use and index to process a WHERE condition that contains any function other than TRIM or SUBSTR.

* conditions joined by the operator OR do not reference the same variable

good luck!

二维码

扫码加我 拉你入群

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

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

2007-7-10 13:08:00
I will take ADV exam next week. Pls share your experience with us. Good luck!
二维码

扫码加我 拉你入群

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

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

2007-7-10 22:31:00

Thanks a million.You guys are so nice.~~~

I'm going to drive to the test centre.........................

just 3hours left..

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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