由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS Macro question, thanks!
相关主题
Stupid SAS programming style is driving me crazy....In SAS , How to call a macro thousands of times?
我是一菜鸟 质疑sas adv63题(12月)第41题的答案[合集] SAS 问题:如何在使用macro的时候保护data。
Need advice on SAS macro debugging请问:为什么if then 在do loop 中就不起作用了呢?
请问这个macro 怎么写?请教一个SAS 数据分配问题
请教一个SAS Macro问题。谢谢请教个SAS macro 问题
请教一个SAS ADV 的题目问个SAS题目,
请帮忙看3道SAS题。How to set initial dataset to zero in a SAS macro?
A problem from SAS Adv testkilltest Q78 79 80
相关话题的讨论汇总
话题: merg话题: macro话题: st话题: sas话题: use
进入Statistics版参与讨论
1 (共1页)
f*****n
发帖数: 67
1
the code is shown as:
%macro merg(st);
data...
...
.../*they do not use argument st in the main code*/
%mend;
Then, it follows:
%merg(1);
The question is why they use st in the argument of merg, and why they put st
=1 to invoke the macro? Can I use %macro merg at the begining, and invoke
the macro as %merg.
It confuses me. Thanks a lot.
s*r
发帖数: 5
2
I am not sure about Macro.
But in other programming languages, this happens when you want to extend
your function later without modifying other codes that call this function.

st

【在 f*****n 的大作中提到】
: the code is shown as:
: %macro merg(st);
: data...
: ...
: .../*they do not use argument st in the main code*/
: %mend;
: Then, it follows:
: %merg(1);
: The question is why they use st in the argument of merg, and why they put st
: =1 to invoke the macro? Can I use %macro merg at the begining, and invoke

r******h
发帖数: 46
3
I have some idea, but not sure it is right.
at here, st inside () is positional parameter.So, when you need 1, you can
simply use %merg(1), when you change to 2, you can just change to %merg(2).
No need to rewrite the whole code.
For example:
%macro sample(a);
proc print data=&a;
run;
%mend;
%sample(b) /*this one print data b*/
%sample(c) /*this one print data c*/
e******o
发帖数: 644
4
有空把C好好学学吧

st

【在 f*****n 的大作中提到】
: the code is shown as:
: %macro merg(st);
: data...
: ...
: .../*they do not use argument st in the main code*/
: %mend;
: Then, it follows:
: %merg(1);
: The question is why they use st in the argument of merg, and why they put st
: =1 to invoke the macro? Can I use %macro merg at the begining, and invoke

f*****n
发帖数: 67
5
They do not use 'st' in the code.
Thank you for your response.

.

【在 r******h 的大作中提到】
: I have some idea, but not sure it is right.
: at here, st inside () is positional parameter.So, when you need 1, you can
: simply use %merg(1), when you change to 2, you can just change to %merg(2).
: No need to rewrite the whole code.
: For example:
: %macro sample(a);
: proc print data=&a;
: run;
: %mend;
: %sample(b) /*this one print data b*/

f*****n
发帖数: 67
6
Yes, this is what i thought at the beginning. But i read the code again, and
it does not contain or cite 'st'. Piratically, I change %merg(1) to %merg(2
), the results are consistent.
Anyway, thanks again.

【在 s*r 的大作中提到】
: I am not sure about Macro.
: But in other programming languages, this happens when you want to extend
: your function later without modifying other codes that call this function.
:
: st

D******n
发帖数: 2836
7
because they are stupid....
just remove st
and u can call ur macro by
%merg

st

【在 f*****n 的大作中提到】
: the code is shown as:
: %macro merg(st);
: data...
: ...
: .../*they do not use argument st in the main code*/
: %mend;
: Then, it follows:
: %merg(1);
: The question is why they use st in the argument of merg, and why they put st
: =1 to invoke the macro? Can I use %macro merg at the begining, and invoke

s*r
发帖数: 5
8
It's certain that the results are consistent.
What I mean is they leave a interface to expanding the function later with
one parameter.
If you can assuare that there is no other calls on this funciton, you surely
can change the function by deleting the parameter.
Otherwise, leave it alone.
Or you can further modify the function by cite st to make it meaningful.

and
(2

【在 f*****n 的大作中提到】
: Yes, this is what i thought at the beginning. But i read the code again, and
: it does not contain or cite 'st'. Piratically, I change %merg(1) to %merg(2
: ), the results are consistent.
: Anyway, thanks again.

p****o
发帖数: 1340
9
hehe, that's true. later on, all of us will have chance to see how people at
various companies work...
so basically, never afraid of your technical skills. folks at this board,
all good luck with your search.

【在 D******n 的大作中提到】
: because they are stupid....
: just remove st
: and u can call ur macro by
: %merg
:
: st

1 (共1页)
进入Statistics版参与讨论
相关主题
killtest Q78 79 80请教一个SAS Macro问题。谢谢
SAS help请教一个SAS ADV 的题目
Help Please! SAS Advanced 考证题求助请帮忙看3道SAS题。
请教一个SAS Macro的问题A problem from SAS Adv test
Stupid SAS programming style is driving me crazy....In SAS , How to call a macro thousands of times?
我是一菜鸟 质疑sas adv63题(12月)第41题的答案[合集] SAS 问题:如何在使用macro的时候保护data。
Need advice on SAS macro debugging请问:为什么if then 在do loop 中就不起作用了呢?
请问这个macro 怎么写?请教一个SAS 数据分配问题
相关话题的讨论汇总
话题: merg话题: macro话题: st话题: sas话题: use