Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: a specific data management problem


From   gjhxmu@sina.com
To   statalist<statalist@hsphsun2.harvard.edu>
Subject   st: a specific data management problem
Date   Wed, 23 Dec 2009 13:47:48 +0800

ear statalists,
I encountered a data management problem. Let take a exerpt of my data to clarify my problem.

clear
input id str20 item amount
1 material 1000
1 "material includes:A" 550
1 "material includes:B" 300
1 labor 400
1 manufacturing 200
2 material 800
2 labor 500
2 "labor includes:a" 300
2 "labor includes:b" 200
3 labor 600
3 material 700
end

The characteristic of the data is that in every id the item(s) for which there are details is(are) variational.
What I expect is as follows. By id, if the sum of the detailed item equals the related total,drop the total observation and keep the detailed ones. Otherwise,keep the total  observation and drop the detailed ones.

Specifically, the result of the above data is 
1 material 1000
1 labor 400
1 manufacturing 200
2 material 800
2 labor includes:a 300
2 labor includes:b 200
3 labor 600
3 material 700

Could anyone help me ? Thank you very much.

Best regards,
Rose.
 

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



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