Statalist The Stata Listserver


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

st: Order


From   Thomas Speidel <[email protected]>
To   [email protected]
Subject   st: Order
Date   Tue, 12 Jun 2007 18:59:46 -0600

I am trying to order the variables of a dataset in a chronological fashion (the month+year is stored in the the varname - the content of the variables is _not_ a date). I have to allow for the possibility of additional variables reflecting future/past dates, hence the lengthy order command. I am not sure why this is happening, since I thought the capture option should take care of it, but the following code does not produce what I had expected:

set obs 10
gen Sector=1
gen Feb2007=2
gen Dec2006=6
gen Oct2006=4
gen Nov2006=84
gen Sep2006=897
gen Jan2007=4.3
capture order Sector Jan2006 Feb2006 Mar2006 Apr2006 May2006 Jun2006 Jul2006 Aug2006 Sep2006 Oct2006 Nov2006 Dec2006 Jan2007 Feb2007 Mar2007 Apr2007 May2007 Jun2007 Jul2007 Aug2007 Sep2007 Oct2007 Nov2007 Dec2007 Jan2008 Feb2008 Mar2008 Apr2008 May2008 Jun2008 Jul2008 Aug2008 Sep2008 Oct2008 Nov2008 Dec2008
des
Contains data
obs: 10 vars: 7 size: 320 (99.9% of memory free)
-------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
Sector float %9.0g Feb2007 float %9.0g Dec2006 float %9.0g Oct2006 float %9.0g Nov2006 float %9.0g Sep2006 float %9.0g Jan2007 float %9.0g -------------------------------------------------------------------------------


Obviously, I am trying to achieve the following order:
Sep2006
Oct2006
Nov2006
Dec2006
Jan2007
Feb2007

Thanks,
Thomas Speidel

*
* 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