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, is already up and running.

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

st: RE: Saving the "j" values in a local after reshape

From   Nick Cox <>
To   "''" <>
Subject   st: RE: Saving the "j" values in a local after reshape
Date   Thu, 1 Mar 2012 16:39:19 +0000

Before the -reshape- 

levelsof year, local(levels) 

(In the current Facebook-free-copy-of-Stata-to-be-given-away-extravaganza-votefest, a few people named -levelsof- as their favourite Stata command!) 

After the -reshape- 

unab years : year* 
local years : subinstr local years "year" "", all 


Davide Cantoni

when using -reshape-, is there any way to save the levels of the "j" variable?

To make my question clearer: a typical -reshape- command will return the output

 *** begin output

. reshape wide inc, i(id) j(year)
(note: j = 1980 1982 1983 1987)

Data                               wide   ->   long

*** end output

So the question is: can this list of numbers (in the example above,
"1980 1982 1983 1987") be saved as a local, for future use?

*   For searches and help try:

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