2023年SASAdv12月真题.doc
《2023年SASAdv12月真题.doc》由会员分享,可在线阅读,更多相关《2023年SASAdv12月真题.doc(75页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、1. When attempting to minimize memory usage, the most efficient way to do group processing when using the MEANS procedure is to use: A. the BY statement. B. GROUPBY with the NOTSORTED specification. C. the CLASS statement. D. multiple WHERE statements. (The question is pretty clear-cut, IMO. It allu
2、des to the standard long- bearded practical trick used in the situation when MEANS/SUMMARY with CLASS uses too much memory. It does not ask what is more efficient in general (which would be to use something else instead of MEANS if possible), just what leads to the minimal memory footprint, and the
3、answer is A. (Answer B is just a distraction - a common device in computer-adaptive tests). The reason is that without BY, MEANS creates and builds its AVL tree for the entire file and all categorical values crossings found in CLASS. With BY, the proc builds the tree for the current BY group only, c
4、omputes the stats, then erases the tree before the next BY group starts, creates and builds it again, and so on. The erase/create process is not a zero cost one, so the smaller the more numerous the BY groups are, the more it slows does the processing; however, the smaller is the largest BY group, t
5、he smaller is the memory footprint.)2. The SAS data set WORK.CHECK has a variable named Id_Code in it. Which SQL statement would create an index on this variable? A. create index Id_Code on WORK.CHECK; B. create index(Id_Code) on WORK.CHECK; C. make index=Id_Code from WORK.CHECK; D.define index(Id_C
6、ode) in WORK.CHECK; 3. Given the SAS data sets: WORK.EMPLOYEE WORK.NEWEMPLOYEE Name Dept Names Salary - - - - Alan Sales Michelle 50000 Michelle Sales Paresh 60000 A SAS program is submitted and the following is written to the SAS log: 101 proc sql; 102 select dept, name 103 from WORK.EMPLOYEE 104 w
7、here name=(select names from newemployee where salary 40000) ERROR: Subquery evaluated to more than one row. 105 ; 106 quit; What would allow the program to successfully execute without errors? A. Replace the where clause with: where EMPLOYEE.Name=(select Names delimited with , from WORK.NEWEMPLOYEE
8、 where Salary 40000); B. Replace line 104 with: where EMPLOYEE.Name =ANY (select Names separated with , from WORK.NEWEMPLOYEE where Salary 40000); (any表达要有多种值,而=只能规定一种值。) C. Replace the equal sign with the IN operator. D. Qualify the column names with the table names. 4. Given the SAS data set SASUS
9、ER.HIGHWAY: Steering Seatbelt Speed Status Count - - - - - absent No 0-29 serious 31 absent No 0-29 not 1419 absent No 30-49 serious 191 absent no 30-49 not absent no 50+ serious 216 The following SAS program is submitted: proc sql noprint; select distinct Speed _insert_SQL_clause_ from SASUSER.HIGH
10、WAY ; quit; title1 Speed values represented are: &GROUPS; proc print data=SASUSER.HIGHWAY; run; Which SQL clause stores the text 0-29, 30-49, 50+ in the macro variable GROUPS? A. into &GROUPS B. into :GROUPS C. into :GROUPS separated by , D. into &GROUPS separated by , (/11/17日考题中选项有改动,不过答案没有变。)5. T
11、he SAS data set WORK.CHECK has an index on the variable Code and the following SAS program is submitted. proc sort data=WORK.CHECK; by Code; run; Which describes the result of submitting the SAS program? A. The index on Code is deleted. B. The index on Code is updated. C. The index on Code is uneffe
12、cted.D. The sort does not execute. (在于有了index旳variable,不能再用by来SORT了。)6. The table WORK.PILOTS contains the following data: WORK.PILOTS Id Name Jobcode Salary - - - - 001 Albert PT1 50000 002 Brenda PT1 70000 003 Carl PT1 60000 004 Donna PT2 80000 005 Edward PT2 90000 006 Flora PT3 100000 The data se
13、t was summarized to include average salary based on jobcode: Jobcode Salary Avg - - - PT1 50000 60000 PT1 70000 60000 PT1 60000 60000 PT2 80000 85000 PT2 90000 85000 PT3 100000 100000 Which SQL statement could NOT generate this result? A. select Jobcode, Salary, avg(Salary) label=Avgfrom WORK.PILOTS
14、group by Jobcodeorder by Id ; B. select Jobcode, Salary, (select avg(Salary) from WORK.PILOTS as P1 where P1.Jobcode=P2.Jobcode) as Avg from WORK.PILOTS as P2 order by Id ; (这里运用旳是自身旳数据集,分别设置不一样旳别名,可以当做两个数据集来使用。不过这里WHERE语句很值得学习,我个人对这里旳WHERE语句这样理解旳:(select avg(Salary) from WORK.PILOTS as P1 where P1.
15、Jobcode=P2.Jobcode)启示执行之后返回旳是三个AVG均值,不过由于这三个AVG均值都是与JOBCODE匹配旳,那么前面旳select Jobcode, Salary,因此当执行到(select avg(Salary) from WORK.PILOTS as P1 where P1.Jobcode=P2.Jobcode)这里时,实际上是选择了select jobcode 中jobcode对应旳avg均值。)C. select Jobcode, Salary, (select avg(Salary) from WORK.PILOTS group by Jobcode) as Avg
16、 from WORK.PILOTSorder by Id ; (子查询波及不止一项。)D. select Jobcode, Salary, Avg from WORK.PILOTS, (select Jobcode as Jc, avg(Salary) as Avg from WORK.PILOTS group by 1)where Jobcode=Jcorder by Id ; 7. A quick rule of thumb for the space required to run PROC SORT is: A. two times the size of the SAS data s
17、et being sorted. B. three times the size of the SAS data set being sorted. C. four times the size of the SAS data set being sorted. D. five times the size of the SAS data set being sorted. (140-: Dear Miss SASAnswers: A Guide to Sorting Your Data 中旳描述是这样旳:If you want the sort to complete entirely in
18、 memory, a simple rule of thumb is four times the size of the data set.In releases prior to SAS 9, the required workspace is approximately three to fourtimes the size of the data file. Beginning with SAS 9, the required workspace isapproximately twice the size of the data file. The workspace can be
19、allocated in memory and/or on disk as a utility file, depending on which sort utility and options are specified.Dear MissSASAnswers, Can you please give me some guidance on how much memory it takes to sort a 2GB table Signed, Memory Deprived Dear Memory Deprived, If you want the sort to complete ent
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2023 SASAdv12 月真题
限制150内