From: Amar Mundankar on
Hi All,
I have one macro program and one dataset.
Dataset ONE has 2 observations and 3 variables.
Macro MYMAC takes 3 input parameters and it simply outputs those input
parameters.


%macro MYMAC(a,b,c);
%put A = &a B = &b C = &c;
%mend;
data one;
X = 1; Y = 2 ; Z = 3;output;
X = 11; Y = 22 ; Z =33;output;
run;

I want to write the code in which macro MYMAC will be called as many
times as many observations are present
in DATASET ONE and for every macro call , values of variables (X,Y and
Z) will be passed to macro.
i.e. Macro MYMAC will be called twice and for the first call input
parameters should be 1,2,3 and for second macro call
the input parameters should be 11,22,33

So, the output in the log will be:
A = 1 B = 2 C = 3
A = 11 B = 22 C = 33

Thanks and Regards,
Amar Mundankar.
From: Antonio on
On 3 jun, 09:37, Amar Mundankar <amarmundan...(a)gmail.com> wrote:
> Hi All,
> I have one macro program and one dataset.
> Dataset ONE has 2 observations and 3 variables.
> Macro MYMAC takes 3 input parameters and it simply outputs those input
> parameters.
>
> %macro MYMAC(a,b,c);
>         %put A = &a B = &b C = &c;
> %mend;
> data one;
>         X = 1; Y = 2 ; Z = 3;output;
>         X = 11; Y = 22 ; Z =33;output;
> run;
>
> I want to write the code in which macro MYMAC will be called as many
> times as many observations are present
> in DATASET ONE and for every macro call , values of variables (X,Y and
> Z) will be passed to macro.
> i.e. Macro MYMAC will be called twice and for the first call input
> parameters should be 1,2,3 and for second macro call
> the input parameters should be 11,22,33
>
> So, the output in the log will be:
> A = 1 B = 2 C = 3
> A = 11 B = 22 C = 33
>
> Thanks and Regards,
> Amar Mundankar.

Hi Amar,

You can do that with CALL EXECUTE sentence. For yor exemple you can do

DATA _NULL_;
SET ONE;
CALL EXECUTE('%MYMAC('||A||','||B||','||C||')');
RUN;

Sorry for my bad english
Antonio Mediero.
From: Arthur Tabachneck on
Amar,

Of course I'm sure that Antonio really meant to type:

data data _null_;
set one;
CALL EXECUTE('%MYMAC('||x||','||y||','||z||')');
run;

HTH,
Art
-------------
On Jun 3, 3:51 am, Antonio <antoniomedi...(a)gmail.com> wrote:
> On 3 jun, 09:37, Amar Mundankar <amarmundan...(a)gmail.com> wrote:
>
>
>
>
>
> > Hi All,
> > I have one macro program and one dataset.
> > Dataset ONE has 2 observations and 3 variables.
> > Macro MYMAC takes 3 input parameters and it simply outputs those input
> > parameters.
>
> > %macro MYMAC(a,b,c);
> >         %put A = &a B = &b C = &c;
> > %mend;
> > data one;
> >         X = 1; Y = 2 ; Z = 3;output;
> >         X = 11; Y = 22 ; Z =33;output;
> > run;
>
> > I want to write the code in which macro MYMAC will be called as many
> > times as many observations are present
> > in DATASET ONE and for every macro call , values of variables (X,Y and
> > Z) will be passed to macro.
> > i.e. Macro MYMAC will be called twice and for the first call input
> > parameters should be 1,2,3 and for second macro call
> > the input parameters should be 11,22,33
>
> > So, the output in the log will be:
> > A = 1 B = 2 C = 3
> > A = 11 B = 22 C = 33
>
> > Thanks and Regards,
> > Amar Mundankar.
>
> Hi Amar,
>
> You can do that with CALL EXECUTE sentence. For yor exemple you can do
>
> DATA _NULL_;
> SET ONE;
> CALL EXECUTE('%MYMAC('||A||','||B||','||C||')');
> RUN;
>
> Sorry for my bad english
> Antonio Mediero.- Hide quoted text -
>
> - Show quoted text -

From: Amar Mundankar on
On Jun 3, 5:05 pm, Arthur Tabachneck <art...(a)netscape.net> wrote:
> Amar,
>
> Of course I'm sure that Antonio really meant to type:
>
> data data _null_;
>   set one;
>   CALL EXECUTE('%MYMAC('||x||','||y||','||z||')');
> run;
>
> HTH,
> Art
> -------------
> On Jun 3, 3:51 am, Antonio <antoniomedi...(a)gmail.com> wrote:
>
>
>
> > On 3 jun, 09:37, Amar Mundankar <amarmundan...(a)gmail.com> wrote:
>
> > > Hi All,
> > > I have one macro program and one dataset.
> > > Dataset ONE has 2 observations and 3 variables.
> > > Macro MYMAC takes 3 input parameters and it simply outputs those input
> > > parameters.
>
> > > %macro MYMAC(a,b,c);
> > >         %put A = &a B = &b C = &c;
> > > %mend;
> > > data one;
> > >         X = 1; Y = 2 ; Z = 3;output;
> > >         X = 11; Y = 22 ; Z =33;output;
> > > run;
>
> > > I want to write the code in which macro MYMAC will be called as many
> > > times as many observations are present
> > > in DATASET ONE and for every macro call , values of variables (X,Y and
> > > Z) will be passed to macro.
> > > i.e. Macro MYMAC will be called twice and for the first call input
> > > parameters should be 1,2,3 and for second macro call
> > > the input parameters should be 11,22,33
>
> > > So, the output in the log will be:
> > > A = 1 B = 2 C = 3
> > > A = 11 B = 22 C = 33
>
> > > Thanks and Regards,
> > > Amar Mundankar.
>
> > Hi Amar,
>
> > You can do that with CALL EXECUTE sentence. For yor exemple you can do
>
> > DATA _NULL_;
> > SET ONE;
> > CALL EXECUTE('%MYMAC('||A||','||B||','||C||')');
> > RUN;
>
> > Sorry for my bad english
> > Antonio Mediero.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Thanks Anatonio and Arthur for your responses.
Acually I have never used CALL routines.
Thats why I was not aware of CALL EXECUTE.
Thanks for introducing me to CALL Routines.

Regards,
Amar Mundankar.