Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Extract year of maximum production


From   Daniel Escher <descher@nd.edu>
To   statalist@hsphsun2.harvard.edu
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.

Best,
Daniel

Daniel Escher
PhD candidate | Sociology
University of Notre Dame
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index