由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 请帮忙看3道SAS题。
相关主题
SAS ADVANCED 一道题求助SAS help
一道ADV 130 题目请问SAS ADV 130中74 和80题
请问SAS advanced macro global 和local在线等:急问大牛帮我看看SAS macro里的问题
SAS call symput questionHow to Macro it in SAS?
求助,SAS ADV 130 中94SAS里用macro的文件名里数字的问题
请教SAS adv 题库一道macro题SAS Macro 问题请教 。。。
a question about SAS请教一个SAS问题:怎样平均地把obs从小到大分成几个Group?
问个SAS题目,SAS初级问题请教
相关话题的讨论汇总
话题: table话题: proc话题: symbol话题: sas话题: macro
进入Statistics版参与讨论
1 (共1页)
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.

1 (共1页)
进入Statistics版参与讨论
相关主题
SAS初级问题请教求助,SAS ADV 130 中94
如何在用SAS给多个data step 和proc step 做循环语句呢?请教SAS adv 题库一道macro题
求助:一个SAS小程序a question about SAS
问一些sas的问题问个SAS题目,
SAS ADVANCED 一道题求助SAS help
一道ADV 130 题目请问SAS ADV 130中74 和80题
请问SAS advanced macro global 和local在线等:急问大牛帮我看看SAS macro里的问题
SAS call symput questionHow to Macro it in SAS?
相关话题的讨论汇总
话题: table话题: proc话题: symbol话题: sas话题: macro