Statalist


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

st: AW: how to generate a variable representing a maximum value within the same category


From   Martin Weiss <[email protected]>
To   [email protected]
Subject   st: AW: how to generate a variable representing a maximum value within the same category
Date   Sat, 19 Jan 2008 13:11:57 +0100

by year, sort: egen var2=max(var1)

-----Urspr�ngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von FUKUGAWA, N.
Gesendet: Samstag, 19. Januar 2008 12:46
An: [email protected]
Betreff: st: how to generate a variable representing a maximum value within
the same category

Dear all,
I have a dataset as follows,

year	var1
1997	14	
1997	32	
1998	18	
1998	42		
1998	50		
1998	1
1999	3	
1999	23	
1999	37	

I want to generate a new variable (var2) representing a maximum
value within the same year.

year	var1	var2
1997	14	32
1997	32	32
1998	18	50
1998	42	50	
1998	50	50	
1998	1	50	
1999	3	37
1999	23	37
1999	37	37

How can I do this using stata9?
Thank you in advance.
---
FUKUGAWA Nobuya, Ph.D.
[email protected]
See my works at www.ssrn.com
*
*   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