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

st: re: panel data manipulation

From   Christopher Baum <>
Subject   st: re: panel data manipulation
Date   Mon, 16 May 2005 06:05:25 -0400

Re my program that creates separate variables for each year: easily changed to what you want (I think)

webuse grunfeld,clear
gen allquartile = .
qui forv i=1935/1954 {
egen quartile`i' = cut(mvalue) if year==`i', group(4)
replace allquartile=quartile`i'+1 if quartile`i' < .
su allquartile

This will create a single variable for which each firm is classified in the quartile in which it falls each year (which may differ over years).

*   For searches and help try:

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