Statalist


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

[no subject]



   . sort id pweek
   . by id: egen visits = count(aweek)
   . by id: egen missed = total(aweek==.)
   . by id: egen unsched = total(pweek==999)
   . list, sepby(id)

     +------------------------------------------------+
     | id   pweek   aweek   visits   missed   unsched |
     |------------------------------------------------|
  1. |  1       0       0       10        0         0 |
  2. |  1       2       2       10        0         0 |
  3. |  1       4       4       10        0         0 |
  4. |  1       8       8       10        0         0 |
  5. |  1      12      12       10        0         0 |
  6. |  1      16      16       10        0         0 |
  7. |  1      20      20       10        0         0 |
  8. |  1      24      24       10        0         0 |
  9. |  1      36      36       10        0         0 |
 10. |  1      52      52       10        0         0 |
     |------------------------------------------------|
 11. |  2       0       0        9        1         0 |
 12. |  2       2       2        9        1         0 |
 13. |  2       4       4        9        1         0 |
 14. |  2       8       .        9        1         0 |
 15. |  2      12      12        9        1         0 |
 16. |  2      16      16        9        1         0 |
 17. |  2      20      20        9        1         0 |
 18. |  2      24      24        9        1         0 |
 19. |  2      36      36        9        1         0 |
 20. |  2      52      52        9        1         0 |
     |------------------------------------------------|
 21. |  3       0       0       11        0         1 |
 22. |  3       2       2       11        0         1 |
 23. |  3       4       4       11        0         1 |
 24. |  3       8       8       11        0         1 |
 25. |  3      12      12       11        0         1 |
 26. |  3      16      16       11        0         1 |
 27. |  3      20      20       11        0         1 |
 28. |  3      24      24       11        0         1 |
 29. |  3      36      36       11        0         1 |
 30. |  3      52      52       11        0         1 |
 31. |  3     999      10       11        0         1 |
     |------------------------------------------------|
 32. |  4       0       0       10        1         1 |
 33. |  4       2       2       10        1         1 |
 34. |  4       4       4       10        1         1 |
 35. |  4       8       .       10        1         1 |
 36. |  4      12      12       10        1         1 |
 37. |  4      16      16       10        1         1 |
 38. |  4      20      20       10        1         1 |
 39. |  4      24      24       10        1         1 |
 40. |  4      36      36       10        1         1 |
 41. |  4      52      52       10        1         1 |
 42. |  4     999      10       10        1         1 |
     +------------------------------------------------+


Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796
Email:  [email protected]
__________________________________________ 


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