s*********h 发帖数: 16 | 1 1。
At the start of a new SAS session; the following program is submitted:
%macro one;
data _null_;
call symput(’proc’,’means’);
run;
proc &proc data=sashelp.class;
run;
%mend;
%one()
What is the result?
(A) The marco variable PRCO is stored in the SAS catalog WORK.SASMACR
(B) The program fails to execute because PROC is a reserved word
(C) The macro variable PROC is stored in the local symbol table
(D) The macro variable PROC is stored in the global symbol table
2。
The following SAS program is s |
s*********h 发帖数: 16 | 2 3。The following SAS program is submitted:
proc sort data=class out=class1 nodupkey;
by name course;
run;
Which SQL procedure program produces the same results?
(A) proc sql;
create table class1 as
select distinct name, course
from class;
quit;
(B) proc sql;
create table class1 as
select nodup name, course
from class;
quit;
(C) proc sql;
create table class1 as
select exclusive name, course
from class;
quit;
(D) proc sql;
create table class1 as
select name, course
from class
order by distinct name |
I**A 发帖数: 96 | 3 1. symput put the macro variable in the local symbol table only when local
symbol table exists;
2. be clear about excution time and compiling time. The 'if' statement can
not control the '%let' statement because they work in two different time
periods.
3. 'distinct' will sort the values. |
w********e 发帖数: 944 | 4 1) D
只有在已经存在local symbol table的前提下,SYMPUT才产生local macro;否则,SYMPUT
产生的macro var在global symbol table中.
2)A
%letcompile时生成macro变量. data step执行时的logic是
if totalobs > 10 then do;
end;
else do;
end; |
q**j 发帖数: 10612 | 5 如果没有更多说明,第三个其实没有正确答案。class里面如果有其他变量怎么办?
这个是base还是adv?真是无聊。 |
s*********h 发帖数: 16 | 6 还有些疑问:
1:how to create a local symbol table? why symput in a data within a macro
definition cannot create a local symbol table itself? |
s*********h 发帖数: 16 | 7 体如说:
%macro one;
%let a=test;
%mend;
%one();
这里的macro variable a 是stored在local symbol table or global symbol table?
Thanks so much. |
g*******y 发帖数: 380 | 8 一直没搞懂turotial里关于proc sql是否排序的问题.
不过这些选项里面好像除了A是不是都有语法错误啊?
我觉得这个题的关键是题目里有nodupkey.
【在 s*********h 的大作中提到】 : 3。The following SAS program is submitted: : proc sort data=class out=class1 nodupkey; : by name course; : run; : Which SQL procedure program produces the same results? : (A) proc sql; : create table class1 as : select distinct name, course : from class; : quit;
|
g*******y 发帖数: 380 | 9
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm confused about this one. If there is local table, then local macro
variable will be created? then how do you create a local table?
According to the online tutorial:
The macro process as following:
Does macvar already exist in the local symbol table?
Yes--> Update macvar in the local symbol table with the value value.
No-->Does macvar already exist in the global symbol table?
【在 w********e 的大作中提到】 : 1) D : 只有在已经存在local symbol table的前提下,SYMPUT才产生local macro;否则,SYMPUT : 产生的macro var在global symbol table中. : 2)A : %letcompile时生成macro变量. data step执行时的logic是 : if totalobs > 10 then do; : end; : else do; : end;
|
w********e 发帖数: 944 | 10 SAS fisrt checks if there is a macro var called a in the local symbol table.
If yes, update a with value test. Otherwise, SAS checks if a is in the
global symbol table. If yes, update a's value using test. Otherwise, create
a macro var called a in the local symbol table and set its value as test.
Read the book or tutorial carefully.
【在 s*********h 的大作中提到】 : 体如说: : %macro one; : %let a=test; : %mend; : %one(); : 这里的macro variable a 是stored在local symbol table or global symbol table? : Thanks so much.
|