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

st: data manipulation


From   <pmitra@mindspring.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: data manipulation
Date   Tue, 02 Jul 2002 14:18:11 -0400

Hello list,
I have a data set like the following.

zipcode	region quantity revenue flag month year
"37075","11",1,0,"EXP","03","2002
"37075","04",53,0,"EXP","03","2002"
"38242","04",14,0,"EXP","03","2002"
"38242","11",1,0,"EXP","03","2002"
"70503","06",25,0,"EXP","03","2002"
"70503","11",1,0,"EXP","03","2002"

I would like to replace the value of region by its value corresponding to
higher quantity by zipcode. For example, for zipcode "37075", I would like to
replace the region's value of "11" by "04" since region "04" has higher
quantity. The new data set will look like the following:
 
"37075","04",1,0,"EXP","03","2002
"37075","04",53,0,"EXP","03","2002"
"38242","04",14,0,"EXP","03","2002"
"38242","04",1,0,"EXP","03","2002"

Can anyone please help me? Thank you.

Sincerely,
Pinaki Mitra



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index