t*****2 发帖数: 94 | 1 SAS程序如下:
data work.totalsales;
set work.monthlysales(keep=year product sales);
retain monthsales{12};
array monthsales{12};
do i=1 to 12;
monthsales{i}=sales;
end;
ent+1;
monthsales{ent}=sales;
run;
这题的答案为什么是“The program fails execution due to syntax errors”
有谁能帮我解答一下。真的太感谢了。
周末愉快! |
|
z*********o 发帖数: 541 | 2 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 | 3 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 | 4 那能不能理解为 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 发帖数: 108 | 5 那能不能理解为 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; |
|
t**c 发帖数: 539 | 6 retain statement是不是不能用来定义array?
试了一下,这样就可以了:
array monthsales{12};
retain monthsales; |
|