RE: st: programming help

 From "MITRA PINAKI (MAR1PXM)" To Subject RE: st: programming help Date Tue, 22 Feb 2005 09:00:17 -0500

```Seb,

Yes, I do need to preserve the order of elements. I forgot to mention in
my posting.

Thanks,
Pinaki

-----Original Message-----
From: Seb Buechte [mailto:sfbuechte@gmail.com]
Sent: Tuesday, February 22, 2005 8:51 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: programming help

I am wondering: do you need to preserve the order of elements in your
vector(s)? In that case sorting etc. will not help and the whole
problem remains more complex...

seb

On Tue, 22 Feb 2005 07:58:17 -0500, MITRA PINAKI  (MAR1PXM)
<mar1pxm@ups.com> wrote:
> Dear all,
>
>     I am struggling with the following problem and wondering if I can
> get any help on this. I have two row vectors, X=(x11, x21, x31, ...,
> xn1)' and Y=(y11, y21, y31, ..., yn1)' where n=300 (I have 300
elements
> in each of the row vectors). My problem is the following: 1) I need to
> calculate the largest value of Y and the smallest value of X. 2) If
the
> largest value of Y is grater than the smallest value of X, replace the
> smallest value of X by the largest value of Y. 3) At the next step,
> ignore the previous largest value of Y and find the largest from the
> rest of the 299 elements of Y. Also for X, find the smallest value of
X
> from the rest of the 299 elements of X and if the largest value of Y
is
> grater than the smallest value of X, replace the smallest value of X
by
> the largest value of Y. 4) The loop stops when the largest value of Y
> from the rest of Y elements is less than equal to the smallest value
of
> X from the rest of X elements. 5) Construct the new X vector (X_NEW)
> with the new elements of Y after replacement keeping the unchanged
> elements of X.
>
> My problem is that I am not able to construct the loop correctly and
> getting no where. Thank you for your help.
>
> Pinaki
>
> _____________________________
> Pinaki Mitra
> UPS Capital
> 35 Glenlake Parkway, NE
> Atlanta, GA 30345
> Office: (404) 828-6759; 5-490-6759 (UPS Atlas)
> Fax:    (404) 828-6660
> Cell:   (404) 668-6575
> Web:   www.upscapital.com
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

--
- Seb F Buechte
-
- Stay in touch!
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```