Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: bysort problem


From   "Sergiy Radyakin" <[email protected]>
To   <[email protected]>
Subject   Re: st: bysort problem
Date   Mon, 26 Feb 2007 14:23:54 +0100

Hi,

Could you please post the original values (not the values after the first iteration) as in the original message and the desired result without any program and temporary variables. Please be more specific on what you are trying to achieve.

Sometimes it is just easier to start from scratch than to look for an error in a foreign code.

Regards, Sergiy


----- Original Message ----- From: "Nikolaos A. Patsopoulos" <[email protected]>
To: <[email protected]>
Sent: Monday, February 26, 2007 2:03 PM
Subject: Re: st: bysort problem



Jeph Herrin wrote:

Original 8 obs?

Nikolaos A. Patsopoulos wrote:


All observations are as they appear. No extra decimals. Here is a revision without touse and locals

tempvar _id
qui gen `_id'=0
local _idN=2
while `_idN'!=1 {
bysort var1 var2: replace `_id'=_n'
count if var3>1
replace var1=var1+(`_id'-1)*0.001 if `_id'>1
sum `_id', detail
local _idN=r(max)
list var1 var2 '_id'
}

*
* 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/

Yep

*
* 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/



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