home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!SWIRL.MONSANTO.COM!GIBES
- Message-ID: <9207311828.AA22390@tin.monsanto.com>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 31 Jul 1992 13:28:47 -0500
- Reply-To: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
- Subject: RE: more on nesting data steps
- Comments: To: SAS-L@uga.cc.uga.edu@tin.monsanto.com
- Comments: cc: GIBES@tin.monsanto.com
- Lines: 66
-
- CONTENT: Response (to "more on nesting data steps")
- SUMMARY: Try SET ... POINT= for all possible pairs in a data step
- REL/PLTF: n.a.
- E-ADDR: gibes@swirl.monsanto.com
- NAME: Kernon Gibes
- PHONE: (708) 506-2873
- DATE: 31 July 1992
-
- I'm going to take a crack at the two postings on "concurrent sas data
- steps" and "more on nesting data steps". No flames please. I fully
- realize that I'm doing some MAJOR guessing here. My intent is not so
- much to answer the question as to provoke further clarification. (I
- don't know who the requestor is).
-
- ASSUMING that all your data is actually in a data set called RAW with
- variables VAR1 to VAR&P (&P = 3 below) and one observation per person
- and ASSUMING that the summary statistics computed for the i-th person
- by all others can be computed without IML code, then a rough sketch of
- an approach using the data set POINT is outlined below. Of course, the
- later assumption is, I think, quite crucial. I'm presuming that the
- requestor can either see how to generalize the fake stats I'm doing or
- see why this approach won't work and explain futher requirements.
-
- /*** define a macro needed for the data step ***/
- %macro rename;
- RENAME=(
- %do i = 1 %to &p;
- var&i = _var&i
- %end;
- )
- %mend rename;
-
- %let P=3;
-
- data stats;
- array vector_i {*} var1-var&p;
- array vector_j {*} _var1-_var&p;
-
- do i=1 to N;
- /*** do summary stats for i, over N-1 pairings
- (zero out i-th summary stats) ***/
- sumcp = 0;
- ssqcp = 0;
- do j=1 to N;
- if i ne j then do;
- /*** load in data for i-th person ***/
- set raw nobs=N point=i;
- outid =id;
- /*** load in data for j-th person ***/
- set raw( %rename ) point=j;
- /*** do summary stats for i, j data pairing
- (zero out summary stats for P by P computations) ***/
- cp = 0;
- do k = 1 to &p;
- cp = cp + vector_i[k] * vector_j[k];
- end;
- /*** do summary stats for N-1 pairings with the i-th person**/
- sumcp = sumcp + cp;
- ssqcp = ssqcp + cp*cp;
- end;
- end;
- output; /*** only need global stats for each person ***/
- end;
- stop; /*** VERY necessary ***/
- keep outid var1-var&p sumcp ssqcp;
- run;
-