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

st: Re: programming advice


From   "Ed Weil" <[email protected]>
To   [email protected]
Subject   st: Re: programming advice
Date   Fri, 17 Dec 2004 10:10:33 +0000

I often get data of this form where x0 corresponds to the value of x1 when month = 0 for each set within code1. This needs to be subtracted from x1 to get a difference. Due to my lack of programming skills I have to inspect the dataset and manually enter the values of x0 for each set of code1. I was trying to write a do-file using if constructs to achieve this with no success. Could somebody tell me if it is possible to program this and point me in the correct direction. The number of results within each "code1" varies.
list code1 month x1 x0 in 11/25

+---------------------------------+
| code1 month x1 x0 |
|---------------------------------|
11. | 6 0 -1.07 -1.07 |
12. | 6 3 -.632 -1.07 |
13. | 7 0 -.292 -.292 |
14. | 7 3 -.595 -.292 |
15. | 8 0 -.269 -.269 |
|---------------------------------|
16. | 8 3 -.056 -.269 |
17. | 9 0 -1.336 -1.336 |
18. | 9 3 -.83 -1.336 |
19. | 9 9 -.792 -1.336 |
20. | 9 16 -.153 -1.336 |
|---------------------------------|
21. | 10 0 -.64 -.64 |
22. | 10 3 -.615 -.64 |
23. | 10 16 -.559 -.64 |
24. | 11 0 -.8 -.8 |
25. | 11 3 -.35 -.8 |
+---------------------------------+
Many thanks,
Ed

_________________________________________________________________
Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/

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