|
AFAIK there is no way.
You may use a macro like the following
%MACRO m;
%LOCAL items word i;
PROC SQL NOPRINT;
SELECT DISTINCT location INTO :items SEPARATED BY ' ' FROM stuff;
QUIT;
%IF ("&items" EQ "") %THEN %DO;
DATA;
text = 'No locations found!';
RUN;
TITLE 'Problem!';
PROC PRINT NOOBS; RUN;
TITLE;
%END;
%ELSE %DO;
%DO i=1 %TO 10000;
%LET word=%SCAN( &items,&i );
%IF ("&word" NE "") %THEN %DO;
TITLE "Location is &word";
options pageno=1;
proc print data=stuff;
by location;
WHERE (location=&word);
run;
TITLE;
%END;
%ELSE
%LET i=10000;
%END;
%END;
%MEND;
OPTIONS NODATE NOBYLINE;
DATA stuff;
DO location=1 TO 10;
DO a=1 TO 100;
OUTPUT;
END;
END;
RUN;
ODS PDF FILE='C:\test\test.pdf';
%m;
* --- and now a test for an empty data set ;
data stuff; stop; run;
%m;
ODS PDF CLOSE;
"Patrick F. O'Neill" <Patrick.F.O'Neill@KP.ORG> schrieb im Newsbeitrag
news:OF82726070.F3848235-ON88256B9E.007DD95E@crdc.kp.org...
> Dear SAS-L,
>
> Is there a way to reset pagination (to page 1) within a single Proc PRINT
> according to the values of the PAGEBY variable?
>
> I would like something like this to work:
>
> proc print data=stuff;
> by location;
> pageby location;
> if first.location then options pageno=1;
> run;
>
> Of course, this is hopeless, since I have a data step "if" and an OPTIONS
> statement in a PROC.
>
> Can I achieve this without breaking up the dataset into small datasets (by
> location) and then printing each one?
>
> Thanks,
> Pat
|