| Date: | Mon, 30 Jul 2001 10:05:29 -0400 |
| Reply-To: | "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM> |
| Subject: | Re: Antwort: READ 5 TIMES THE SAME DATA SET |
|
| Content-Type: | text/plain; charset=iso-8859-1 |
Peter,
To this I might add that more than one buffer can be prepared - which of
course means more than one SET statement, each initiating its own
independent input stream. One buffer is certainly preferable from the memory
usage standpoint. However, whether to use one SET calling the same file name
N times or N SET statements each calling the same file mane, depends on the
order in which the observations need to be utilized. The following steps,
both reading a 3-records file A containing a single VAR assuming values 1,
2, 3, might demonstrate the point:
42 data _null_ ;
43 set a a ; put _n_= var = ;
44 run ;
_N_=1 var=1
_N_=2 var=2
_N_=3 var=3
_N_=4 var=1
_N_=5 var=2
_N_=6 var=3
NOTE: There were 3 observations read from the data set WORK.A.
NOTE: There were 3 observations read from the data set WORK.A.
45 data _null_ ;
46 set a ; put _n_= var = ;
47 set a ; put _n_= var = ;
48 run ;
_N_=1 var=1
_N_=1 var=1
_N_=2 var=2
_N_=2 var=2
_N_=3 var=3
_N_=3 var=3
NOTE: There were 3 observations read from the data set WORK.A.
NOTE: There were 3 observations read from the data set WORK.A.
Kind regards,
======================
Paul M. Dorfman
Jacksonville, Fl
======================
-----Original Message-----
From: Peter Crawford [mailto:peter.crawford@DB.COM]
Sent: Monday, July 30, 2001 7:44 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Antwort: READ 5 TIMES THE SAME DATA SET
Hi Nicolas
In a data step. the set statement prepares something like an input buffer
for the data.
No matter how many times your logic passes through that statement, only one
set of buffers is prepared.
Normally your data step will stop when the input from this set of buffers is
exhausted.
A set statement can refer to more than one data set
set data.a data.b data.c;
Then, when the first data set is finished, sas starts to deliver
observations from the next.
These could be the same data set names like
set tiers tiers tiers tiers tiers;
which delivers all data from the sas data set work.TIERS 5 times.
good luck
Datum: 30/07/2001 11:02
An: SAS-L@listserv.uga.edu
Antwort an: Nicolas Pont <nicolas.pont@UNICIBLE.CH>
Betreff: READ 5 TIMES THE SAME DATA SET
Nachrichtentext:
1) Construct a data set with for example 5 records
2) Test this program
How can I read for example 5 times all the same data set in the same
data step
data test /debug ;
/* I would like to read the data set 5 times */
do i=1 to 5 ;
/* I read all the data set */
do j=1 to 5 ;
set tiers ;
end ;
end ;
run ;
_________________________
Nicolas Pont
Unicible
tel: +41 (0)27/327 4208
fax: +41 (0)27/327 4255
mailto:nicolas.pont@unicible.ch
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.
|