|
Jeff:
This solution has a crippling limitation, but it has other virtues of
interest. The maximum number of table references in a SAS V8.2 SQL query is
32. If that number increases in future versions, a view of the unions of a
dataset to itself would produce the data you require:
data test;
tag='XXXXXXXX';
value='YYYYYYYY';
run;
%let __n=31;
filename tmp 'c:\Windows\temp\tmp.sas';
data _null_;
file tmp;
put ' proc sql; create view tempvw as select * from ' /
' (select * from work.test) ' ;
do i=1 to &__n;
put ' union all ' /
' (select * from work.test) ' ;
end;
put '; quit;';
run;
%inc tmp;
proc freq data=tempvw;
table tag value/list;
run;
A view gives you a virtual dataset, but occupies only the space required to
store a program. This program also illustrates a method for using a SAS
datastep to write a SAS program.
Sig
-----Original Message-----
From: Jeff Cohen [mailto:jcohen@AESSUCCESS.ORG]
Sent: Wednesday, November 19, 2003 9:10 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Setting Dataset Multiple Times
Is there a way to create dataset A by setting dataset B multiple times, with
the number of times dynamically determined? On the first run the dataset
will be set 37 times, based on a number in the first observation. That
number can and will change on subsequent runs, sometimes up and sometimes
down.
|