|
... I think (don't know for sure) a little more is necessary to get it to work. See below!
----------------------------------------------
Gerhard Hellriegel
DeTeCSM / SLM
Im Leuschnerpark 4
64347 Griesheim
Tel.: +49 6151 818 9806
Fax: +49 6151 818 9611
Mobil: 0171 2263497
e-mail: gerhard.hellriegel@telekom.de
privat: ghellrieg@t-online.de
----------------------------------------------
> -----Urspr> üngliche Nachricht-----
> Von: Peter Crawford [SMTP:peter.crawford@DB.COM]
> Gesendet am: Montag, 5. Juni 2000 18:27
> An: SAS-L@LISTSERV.UGA.EDU
> Betreff: Do loop problem
>
> To load an array, and run Paul's pseudo code
> data _null_ ;
> /* define and load the array */
> array P(100) _temposary_;
> do i = 1 to 100;
> set <your data set> POINT=I ;
> p(i) = p ;
> end;
> /* Paul's code follows */
> TOT=0;
> DO I=1 TO 100;
> DO J=1 TO 100;
> TOT=TOT+(P{I}-P{J});
> END;
> END;
>
>
> /* now output the total, for example */
> put tot= ;
> stop;
> run;
>
> It might get a little more complex if there are more or less than 100 obs.
>
> Regards
> Peter Crawford
>
>
>
> Datum: 05.06.2000 17:00
> An: SAS-L@listserv.uga.edu
>
>
>
>
> Antwort an: maxim@uwo.ca
>
> Betreff: Do loop problem
> Nachrichtentext:
>
>
> This is a multi-part message in MIME format.
> --------------A48C53391317DD06EF919CCF
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> I would appreciate any help with what should be a trivial programing
> problem. Essentially, I have created a SAS data set containing one
> variable, P, with 100 observations in it. I would now like to execute
> the following pseudo code (which finds the sum of all possible
> differences between the observtions in P) within a subsequent DATA
> statement.
>
> TOT=0;
> DO I=1 TO 100;
> DO J=1 TO 100;
> TOT=TOT+(P{I}-P{J});
> END;
> END;
>
> Thanks,
> Paul Maxim
>
> --------------A48C53391317DD06EF919CCF
> Content-Type: text/x-vcard; charset=us-ascii;
> name="maxim.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Paul Maxim
> Content-Disposition: attachment;
> filename="maxim.vcf"
>
> begin:vcard
> n:Maxim;Paul
> tel;fax:519-661-3200
> tel;home:519-473-0413
> tel;work:519-661-2111 Ext. 85121
> x-mozilla-html:FALSE
> org:University of Western Ontario;Sociology
> adr:;;;London;Ontario;N6A 5C2;Canada
> version:2.1
> email;internet:maxim@uwo.ca
> end:vcard
>
> --------------A48C53391317DD06EF919CCF--
|