Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: programming help


From   "MITRA PINAKI (MAR1PXM)" <[email protected]>
To   <[email protected]>
Subject   st: programming help
Date   Tue, 22 Feb 2005 07:58:17 -0500

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index