|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: dates
Couldn't you just do
replace exitdate=16801 if year(exitdate)==2006
It works for me:
. format junk %dD_m_Y
. d junk
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
junk long %dD_m_Y
. cl junk in 1/5, noobs
junk
30 Jan 00
30 Jan 00
24 Jul 06
24 Jul 06
30 Jan 00
. replace junk=16801 if year(junk)==2006
(550 real changes made)
. cl junk in 1/5, noobs
junk
30 Jan 00
30 Jan 00
31 Dec 05
31 Dec 05
30 Jan 00
hth,
liz
Michael Blasnik wrote:
It looks like your exitdate is actually an encoded string variable and
not really a Stata date variable. Try:
label list exitdate
or
sum exidate
to see if there is a value label that makes it look like it holds
dates but the true numeric values are not Stata date values. If so,
you may need to decode the variable, then apply the date() function to
the string variable to re-create it as a true date formatted numeric
field.
M Blasnik
----- Original Message ----- From: "P chrisman" <[email protected]>
To: <[email protected]>
Sent: Friday, August 17, 2007 4:35 PM
Subject: Re: st: dates
Dear List
I tried this and keeping getting the message that no changes were
made when there are definitely changes that should have been made.
. replace exitdate=mdy(12,31,2005) if year(exitdate)==2006
(0 real changes made)
I do not know what it means but when browsing data the "exitdate" is
in blue with dashes and "entrydate" is in black with spaces. The
formats are:
describe exitdate entrydate
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
exitdate long %dD_m_Y exitdate entrydate long
%dD_m_Y
I am confused why this command in not capturing the dates I need to
change.
Thanks,
Peggy
*
* 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/
*
* 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/