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

st: RE: Re-defining a variable's type but keeping it "in place"


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re-defining a variable's type but keeping it "in place"
Date   Thu, 9 Dec 2004 23:33:37 -0000

You could make use of -order-
or -move-. 

order *1 *2

See help on -order-.  

Nick 
[email protected] 

[email protected]
> 
> I have a tab-separated data set which contains a number of 
> dates entered as strings. Converting the strings to dates is 
> no problem using the 'date' function, but the new variable is 
> added to the end of the data set. For example, if I have a 
> data set that has the following variables
> 
> id stringdate1 info1 stringdate2 info2
> 
> (where the stringdates are dates encoded as strings) and I 
> cast the strings into real dates (and delete the strings), I 
> end up with a data set that looks like
> 
> id info1 info2 realdate1 realdate2
> 
> Not a problem for a data set with five columns, but real data 
> sets are much broader. In any case, it would be nice to keep 
> all the '1' data items together etc.
> 
> Can I convert data 'in place' or move columns back to their 
> 'original' positions?
> 

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