From: Tom Abernathy on
I think you are asking if you could just iterate ovar a list of
dataset names?
Similar to what you can with DATA step DO loop like this:
do name = 'p_one','p_two','p_three' ;
...
end;

I do not know of a way to do that with macro logic, but you could use
a delimited list of names in a macro variable instead;

%let names=p_one p_two p_three;
%do i=1 %to %sysfunc(countw(&names));
%let name=%scan(&names,&i);
...
%end;



On Feb 21, 1:07 am, kuh...(a)126.COM (Clark An) wrote:
> %do q = 1 %to &n;
>  PROC FSEDIT DATA=dedata.p&&dsn&q  mod
>   SCREEN=GLSCN.descn.p&&dsn&q...SCREEN;
>  RUN;
> %end;
>
> Is it possible to just use do not %do in the sample code,but set macro
> variable q value with the loop values?
>
> TIA

From: Joe Matise on
You could rewrite that code with CALL EXECUTE in a datastep, which would
make use of DO instead of %DO. But I don't know why you'd ask the question
that way. If you have a particular reason for this and it isn't an exam
question or something, feel free to write back to the list with a bit more
detail so we can advise you better.

Thanks,
Joe

On Sun, Feb 21, 2010 at 12:07 AM, Clark An <kuhasu(a)126.com> wrote:

> %do q = 1 %to &n;
> PROC FSEDIT DATA=dedata.p&&dsn&q mod
> SCREEN=GLSCN.descn.p&&dsn&q...SCREEN;
> RUN;
> %end;
>
> Is it possible to just use do not %do in the sample code,but set macro
> variable q value with the loop values?
>
> TIA
>
From: xlr82sas on
On Feb 21, 9:12 am, snoopy...(a)GMAIL.COM (Joe Matise) wrote:
> You could rewrite that code with CALL EXECUTE in a datastep, which would
> make use of DO instead of %DO.  But I don't know why you'd ask the question
> that way.  If you have a particular reason for this and it isn't an exam
> question or something, feel free to write back to the list with a bit more
> detail so we can advise you better.
>
> Thanks,
> Joe
>
> On Sun, Feb 21, 2010 at 12:07 AM, Clark An <kuh...(a)126.com> wrote:
> > %do q = 1 %to &n;
> >  PROC FSEDIT DATA=dedata.p&&dsn&q  mod
> >  SCREEN=GLSCN.descn.p&&dsn&q...SCREEN;
> >  RUN;
> > %end;
>
> > Is it possible to just use do not %do in the sample code,but set macro
> > variable q value with the loop values?
>
> > TIA

If your are using 9.2 I think you can accomplish this using FCMP and
RUN_MACRO. I am on my mac right now and do not have access to SAS.

data _null_;
do q=1 to 10;
call fse(q,'dsn');
end;
stop;
run;


From: Clark An on
Thank you.
I just wanna drop the %do but there's a problem when naming variables with
macro variable;
and for the example you have given,Am afraid there r to many names...
From: Clark An on
Thank you.
And how abt:
do i=1 to 5;
..../*setting value of macro variable*/
x&i=&i;
end;