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

st: RE: using creat count id on var


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: using creat count id on var
Date   Mon, 28 Feb 2005 09:10:52 -0000

Have a look at -egen-. For example,

bys id visitno: egen maxv=max(var1)
bys id visitno: egen meanv=mean(var1)

David

-----Original Message-----
From: Richard Hiscock [mailto:[email protected]]
Sent: 27 February 2005 19:34
To: [email protected]
Subject: st: using creat count id on var


Thanks Nick for your reply
Im obviously finding it difficult to develop in this area
I cant find a useful guide,any pointers?

My problem now is that having identified the visitno within id I wish to 
perform manipulations on a variable. For example
using the illustrated structure.
To obtain the maximum value of var1 within id at each level  of visitno.
To obtain the mean value of var1 within id at each level of visitno

    id           date          visitno      var1
>     1        16267         1             53
>     1        16267         1            106
>     1        16267         1            84
>     1        16267         1            90
>     1        16267         1            76
>     1        16267         1            65
>     1        16298         2             87
>     1        16298         2            76
>     2        15678         1            98
>     2        15678         1            98
>     2         16541        2            150
>




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



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