由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 求教sas adv题目
相关主题
请教SAS ADV 50 中的一道简单macro题目一个关于macro的问题,多谢。
请教一个SAS Macro问题。谢谢Stupid SAS programming style is driving me crazy....
SAS Regression Macro 问题请教 (有包子)Need advice on SAS macro debugging
SAS ADVANCED 一道题求助How to the macro regression with if?
SAS call symput questiona sas adv question
请教一道SAS maro的题macro variable 的问题
请教SAS adv 题库一道macro题how to make this macro work, thanks
问一些sas的问题一道ADV 130 题目
相关话题的讨论汇总
话题: mv话题: macro话题: sas话题: product话题: variable
进入Statistics版参与讨论
1 (共1页)
z*******e
发帖数: 32
1
被两道题搞得头晕,请路过的大侠指点,跪谢!
1. The following SAS program is submitted:
%let Mv=shoes;
%macro PRODUCT(Mv=bicycles);
%let Mv=clothes;
%mend;
%PRODUCT(Mv=tents)
%put Mv is &Mv;
What is written to the SAS log?
A.Mv is bicycles
B.Mv is clothes
C.Mv is shoes
D.Mv is tents
这道题答案是C,理由是local macro variable在macro结束以后就被清空了,global
macro variable的值shoes还在,所以要用global的。
2. The following SAS program is submitted:
%let a=cat;
%macro animal;
%let a=dog;
%mend;
%animal
%put a is &a;
Which one of the following is written to the SAS log?
Correct answer: d
a. a is
b. a is &a
c. a is cat
d. a is dog
如果照第一道题的解释,岂不是要选C。怎么这道题又变成了选D?
Z********6
发帖数: 10
2
1.
%let Mv=shoes; *here Mv is a global macro variable;
%macro PRODUCT(Mv=bicycles); *here Mv is a local macro variable;
%let Mv=clothes; *here Mv is a local macro variable;
%mend;
%PRODUCT(Mv=tents);
%put Mv is &Mv; * => Mv is shoes;
2.
%let Mv=shoes; *here Mv is a global macro variable;
%macro PRODUCT;
%let Mv=clothes; *here Mv is a global macro variable;
%mend;
%PRODUCT; *replace previous Mv value;
%put Mv is &Mv; * => Mv is clothes;
Hope this will help you to see the difference and know why.
z*******e
发帖数: 32
3
This is really helpful! Appreciated it...
是不是可以这样理解,一个macro variable是global还是local,跟这个variable是否
是在macro里面被defined是没关系的?
L**********A
发帖数: 7115
4
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML

【在 z*******e 的大作中提到】
: This is really helpful! Appreciated it...
: 是不是可以这样理解,一个macro variable是global还是local,跟这个variable是否
: 是在macro里面被defined是没关系的?

z*******e
发帖数: 32
5
谢谢 LamborghiniA (哈蜜z)!
1 (共1页)
进入Statistics版参与讨论
相关主题
一道ADV 130 题目SAS call symput question
请教一个macro的问题请教一道SAS maro的题
急问:SAS batch submission with macro variable请教SAS adv 题库一道macro题
proc iml help!问一些sas的问题
请教SAS ADV 50 中的一道简单macro题目一个关于macro的问题,多谢。
请教一个SAS Macro问题。谢谢Stupid SAS programming style is driving me crazy....
SAS Regression Macro 问题请教 (有包子)Need advice on SAS macro debugging
SAS ADVANCED 一道题求助How to the macro regression with if?
相关话题的讨论汇总
话题: mv话题: macro话题: sas话题: product话题: variable