Date: Wed, 19 Nov 2003 09:46:27 -0500
Reply-To: msz03@HEALTH.STATE.NY.US
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@HEALTH.STATE.NY.US>
Subject: Re: Setting Dataset Multiple Times
Content-type: text/plain; charset=us-ascii
Hi...could also APPEND rather than SET many times...
%macro makeb;
%local howmany;
proc datasets lib=work nolist;
delete b;
quit;
data _null_;
set a (obs=1);
call symput('howmany',put(loops,best.));
run;
%do dsets=1 %to &howmany;
proc append base=b data=a;
run;
%end;
%mend;
data a;
input loops y z;
datalines;
37 4 5
6 7 8
1 2 3
;
run;
options mprint;
%makeb;
*** 37 copies of A in data set B;
proc print data=b;
run;
Mike Zdeb
U@Albany School of Public Health
1 University Drive
Rensselaer, NY 12144-3456
(P)518-402-6479
(F)630-604-1475
|---------+----------------------------->
| | "Groeneveld, Jim" |
| | <jim.groeneveld@VI|
| | TATRON.COM> |
| | Sent by: "SAS(r) |
| | Discussion" |
| | <SAS-L@LISTSERV.UG|
| | A.EDU> |
| | |
| | |
| | 11/19/2003 09:34 |
| | AM |
| | Please respond to |
| | "Groeneveld, Jim" |
| | |
|---------+----------------------------->
>----------------------------------------------------------------------------------------------------------------------|
| |
| To: SAS-L@LISTSERV.UGA.EDU |
| cc: |
| Subject: Re: Setting Dataset Multiple Times |
>----------------------------------------------------------------------------------------------------------------------|
Hi Jeff,
How about something like this? Tell me whether this works as intended.
DATA _NULL_;
SET B;
CALL SYMPUT ('Loops', INPUT ( Loops, BEST. ) );
STOP; * Process only the first record with value for loops;
RUN;
%MACRO BlowUp (Loops);
DATA MultiSet;
SET
%DO I = 1 %TO &Loops;
A /* dataset A, no semicolon */
%END;
; /* this is the SET closing semicolon */
RUN;
%MEND BLowUp;
%BlowUp (&Loops);
Regards - Jim.
--
. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
Biostatistician
Science Team
Vitatron B.V.
Meander 1051
6825 MJ Arnhem
Tel: +31/0 26 376 7365
Fax: +31/0 26 376 7305
Jim.Groeneveld@Vitatron.com
www.vitatron.com
My computer has the solutions, I have the problems.
[common disclaimer]
-----Original Message-----
From: Jeffrey Cohen [mailto:jcohen@aessuccess.org]
Sent: Wednesday, November 19, 2003 15:21
To: Groeneveld, Jim
Subject: RE: Setting Dataset Multiple Times
Jim,
I have Dataset B that contains 5 variables, one is called "loops". If the
number in "loops" = 37 then I need to set dataset B 37 times to create
dataset A. As this program runs once a quarter the value for "loops" will
change and may be only 25 or 56. Does this help?
Thanks,
Jeff
Jeff Cohen
Statistical Analyst
Research and Policy Analysis
AES/PHEAA
717-720-2818
"Groeneveld, Jim"
<jim.groeneveld@vi To: "Jeff Cohen"
<jcohen@AESSUCCESS.ORG>
tatron.com> cc:
Subject: RE: Setting
Dataset Multiple Times
11/19/03 09:17 AM
Hi Jeff,
Rather complicated at first sight. But so is your Q. Could you elaborate a
little more? Give an example. Would you want a complete dataset B be
repeated N times in A as additional records, dependent on some value in the
first record of B? Or do you intend something else.
Regards - Jim.
--
. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
Biostatistician
Science Team
Vitatron B.V.
Meander 1051
6825 MJ Arnhem
Tel: +31/0 26 376 7365
Fax: +31/0 26 376 7305
Jim.Groeneveld@Vitatron.com
www.vitatron.com
My computer has the solutions, I have the problems.
[common disclaimer]
-----Original Message-----
From: Jeff Cohen [mailto:jcohen@AESSUCCESS.ORG]
Sent: Wednesday, November 19, 2003 15:10
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.