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
|
|