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/