Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Extract year of maximum production

From   Daniel Escher <>
Subject   st: Extract year of maximum production
Date   Fri, 19 Oct 2012 23:10:20 -0400

I have 100 years of timber production data for all counties in the US
(~3,100). The data are currently in wide format - i.e., timber1910,
timber1911 ... timber2010 (but I can switch them to long if needed).

I would like to extract the year of maximum timber production for each
county and put that year in a variable called "peakyr." Two things I
thought might be helpful: 1) I can use -egen newvar = rowmax...- to get the
maximum value of a row. 2) I can separate the stub and the year in the
variable name using the -substr- function. Unfortunately, I don't know how
to make those two processes  "talk" to each other - if they are even the
right ones to use.

Stata/IC 12.1 for Windows (32-bit)
Revision 01 Oct 2012

Thank you for your help and time.


Daniel Escher
PhD candidate | Sociology
University of Notre Dame
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index