z*********o 发帖数: 541 | 1 117. The following SAS program is submitted:
data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;
The data set named WORK.MONTHLYSALES has one observation per month
for each of five years for a total of 60 observations.
Which one of the following is the result of the above program?
A00-211
- 36 - http://www.ePlanetLabs.com
A. The program fails execution due to data errors.
B. The p |
S***e 发帖数: 108 | 2 array monthsales {12}只是分配给array的名称,data step中没有对应的variable,
所以syntax error.
改成:
data work.totalsales (keep = mon1-mon12 );
set work.monthlysales (keep = year product sales);
array monthsales {12} mon1-mon12;
do i=1 to 12;
monthsales{i} = sales;
end;
run; |
z*********o 发帖数: 541 | 3 那能不能理解为 monthsales{12}的默认的variable 是 monthsales1-12?
还是只有在array的语句中如果只写出 arrary monthsales{12} 认为默认的variable
是 monthsles1-12?
因为另外这道44题,new variable没有选B,但是在题目当中B选项中的variable也没有
给出,是不是他们是默认的variable呢?
44. The following SAS program is submitted:
data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
array monthly{3} jansales febsales marsales;
run;
Which one of the following represents the new variables that are created?
A. JANSALES, FEBSALE
【在 S***e 的大作中提到】 : array monthsales {12}只是分配给array的名称,data step中没有对应的variable, : 所以syntax error. : 改成: : data work.totalsales (keep = mon1-mon12 ); : set work.monthlysales (keep = year product sales); : array monthsales {12} mon1-mon12; : do i=1 to 12; : monthsales{i} = sales; : end; : run;
|
S***e 发帖数: 108 | 4 那能不能理解为 monthsales{12}的默认的variable 是 monthsales1-12?
不能.
还是只有在array的语句中如果只写出 arrary monthsales{12} 认为默认的variable
是 monthsles1-12?
必须指定variable.
因为另外这道44题,new variable没有选B,但是在题目当中B选项中的variable也没有
给出,是不是他们是默认的variable呢?
44. The following SAS program is submitted:
data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
~~~~~~~~~~~~~~~~~~~~~~~这里指定了variable,没有默认一说
,建议仔细看关于array的定义。
array monthly{3} jansales febsales marsales; |
z*********o 发帖数: 541 | 5 那44题中,B为何不对呢?谢谢
【在 S***e 的大作中提到】 : 那能不能理解为 monthsales{12}的默认的variable 是 monthsales1-12? : 不能. : 还是只有在array的语句中如果只写出 arrary monthsales{12} 认为默认的variable : 是 monthsles1-12? : 必须指定variable. : 因为另外这道44题,new variable没有选B,但是在题目当中B选项中的variable也没有 : 给出,是不是他们是默认的variable呢? : 44. The following SAS program is submitted: : data work.test; : set work.staff (keep = jansales febsales marsales);
|
S***e 发帖数: 108 | 6 呵呵,所以让你去学习关于array的定义嘛。。。
数组的名称类似一个中间代号,但不是变量名。
题目中没有任何一个地方定义了MONTHLY1, MONTHLY2 and MONTHLY3。所以B肯定不对。
用数组赋值时,应该是用MONTHLY{1}, MONTHLY{2} and MONTHLY{3}。
接下来,你该又要问,如果B选项是MONTHLY{1}, MONTHLY{2} and MONTHLY{3}能不能选
了,呵呵。。。
答案是,不能。
因为MONTHLY{1} MONTHLY{2} MONTHLY{3}直接对应着jansales febsales marsales,
respectively。而这三个变量在staff中已经定义过了。
这样能够理解了么?:) |
z*********o 发帖数: 541 | 7 谢谢~~~~ :)
【在 S***e 的大作中提到】 : 呵呵,所以让你去学习关于array的定义嘛。。。 : 数组的名称类似一个中间代号,但不是变量名。 : 题目中没有任何一个地方定义了MONTHLY1, MONTHLY2 and MONTHLY3。所以B肯定不对。 : 用数组赋值时,应该是用MONTHLY{1}, MONTHLY{2} and MONTHLY{3}。 : 接下来,你该又要问,如果B选项是MONTHLY{1}, MONTHLY{2} and MONTHLY{3}能不能选 : 了,呵呵。。。 : 答案是,不能。 : 因为MONTHLY{1} MONTHLY{2} MONTHLY{3}直接对应着jansales febsales marsales, : respectively。而这三个变量在staff中已经定义过了。 : 这样能够理解了么?:)
|
S***e 发帖数: 108 | 8 我在做题的过程中发现我以前对array的理解有偏差,所以以前对你的解释可能有不准
确的地方,看来我自己也还得认真学,呵呵。。。
用array定义看来是有默认变量一说,比如,
array monthly{3};
在SAS中,的确会创建三个默认的变量,monthly1 monthly2 monthly3。
但是在44题中,
44. The following SAS program is submitted:
data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
~~~~~~~~~~~~~~~~~一旦在定义array后给出了具体的变量
名,那么这些变量是新创建的变量。
array monthly{3} jansales febsales marsales;
run;
Which one of the following represents the new variables that |
z*********o 发帖数: 541 | 9 谢谢,一直这末热心的答复我的简单问题。
呵呵,今天刚刚考完,pass了
【在 S***e 的大作中提到】 : 我在做题的过程中发现我以前对array的理解有偏差,所以以前对你的解释可能有不准 : 确的地方,看来我自己也还得认真学,呵呵。。。 : 用array定义看来是有默认变量一说,比如, : array monthly{3}; : 在SAS中,的确会创建三个默认的变量,monthly1 monthly2 monthly3。 : 但是在44题中, : 44. The following SAS program is submitted: : data work.test; : set work.staff (keep = jansales febsales marsales); : array diff_sales{3} difsales1 - difsales3;
|