Date: Tue, 30 Oct 2001 09:47:45 -0500
Reply-To: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Subject: Re: Little MACRO !!! :)
Content-Type: text/plain; charset="iso-8859-1"
Franz,
This is a simple version of a macro that can do what you asked for. Note
that it will produce N output records for each input record in dataset FILL.
hth,
Dennis Diskin
%macro fill(var1,values);
Data fill;
set fill;
%local i;
%let i = 1;
%do %until(%scan(&values,&i) = );
&var1 = %scan(&values,&i);
count=0;
percent=0;
output;
%let i = %eval (1+&i);
%end;
run;
%mend fill;
%fill (testvar,1 2 4);
> -----Original Message-----
> From: A. L. [SMTP:franz_cl2003@YAHOO.FR]
> Sent: Tuesday, October 30, 2001 8:37 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Little MACRO !!! :)
>
> Dear All,
>
> Let's say I have this little macro;
>
> %MACRO fill (var_1, value_1);
>
> DATA fill;
> SET fill;
> &var_1 = &value_1; count = 0; percent = 0; output;
> RUN;
> %MEND fill;
>
> My problem is, sometime I need to write 1, 2 or 3 new
> observation(s) in the file fill.
> I mean:
>
> &var_1 = &value_1; count = 0; percent = 0; output;
> &var_1 = &value_2; count = 0; percent = 0; output;
> &var_1 = &value_1; count = 0; percent = 0; output;
>
> How should I modify my macro to achieve this?
>
> Thanks a lot for your time and patience.
> Regards.
>
> Franz.
>
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Courrier : http://courrier.yahoo.fr
|