Hello Eva,
Please find the code below . My apologies for the inconvenience.
local num=_N
forvalues index=1/`num'{
forvalues j = 1/12 {
local i=`j'
while `i' <=12 {
if ( node`i'[`index']<node`j'[`index'] ){
local dummy=node`i'[`index']
replace node`i'=node`j'[`index'] in `index'
replace node`j'=`dummy' in `index'
}
local i=`i'+1
}
}
}
Thank you for your help,
Ashim.
On Mon, Aug 25, 2008 at 5:44 PM, Eva Poen <[email protected]> wrote:
> Ashim,
>
> please post your code so that we can see exactly what you are doing.
> "A simple bubble for each row" can be just about anything.
> Are you talking about _sorting_ (which affects entire rows of the
> dataset), or _replacing_ your data? v1[i] < = v2[i] <=... v6[i] is
> either true for each observation (i.e. row) or it's not true. If it't
> not true, sorting (-help sort-) is not going to help.
>
> Eva
>
>
> 2008/8/25 Ashim Kapoor <[email protected]>:
>> Hello everyone,
>>
>> I have a simple code to write.
>>
>> I have 6 variables v1, v2 , v3, v4 ,v5 , v6.
>>
>> I want to sort "according to each observation". That is , in the end
>> for each i I want , v1[i] < = v2[i] <=... v6[i].
>>
>> So I wrote a simple bubble for each row and then loop from 1 to _N.
>>
>> Now the problem is that this works but it's VERY VERY slow. Any
>> comments anyone ?
>>
>> Thank you guys,
>> Ashim. : )
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/