Statalist The Stata Listserver


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

st: RE: editing date directly in the editor


From   "Steichen, Thomas J." <[email protected]>
To   <[email protected]>
Subject   st: RE: editing date directly in the editor
Date   Tue, 26 Dec 2006 10:35:17 -0500

Sorry, you can't do it directly. 

However, you can create a string version of your dates, 
edit those, then reconvert to Stata date format:

Assuming your date variable is called "date"...

  gen dates = string(day(date)) + "/" + string(month(date)) + "/" + string(year(date))

    <edit dates in the data editor spreadsheet>

  gen tempdate = date(dates,"dmy")
  replace date=tempdate
  drop dates tempdate

I'd create the new numeric (Stata) date as "tempdate" so you can check it before
replacing the old "date" and so you don't lose your labeling, location, etc. for "date".

Of course, you can create the string date (dates) in any format you prefer. 
Just change the later tempdate generation to match.

Tom

-----------------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------------



> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of josemaria
> Sent: Tuesday, December 26, 2006 9:52 AM
> To: [email protected]
> Subject: st: editing date directly in the editor
> 
> 
> Dear people:
> please, is there a way to edit (to correct) dates directly in 
> the edit 
> spreadsheet, using the writen dates instead of the elapsed days?
> Correcting a few dates using _replace_ is OK, but for too many it is 
> annoying.
> Thank for the help and good 2007.
> Jos� Maria
> 
> Jos� Maria Pacheco de Souza, Professor Titular (aposentado)
> Departamento de Epidemiologia
> Faculdade de Sa�de P�blica/Universidade de S�o Paulo
> Av. Dr. Arnaldo, 715 cep 01246-904
> S�o Paulo Brasil
> fones (11)3082-3886  (11)3061-7724 (11)3714-2403  (11)3768-8612
> fax   (11)3082-2920  (11)3714-2403
> www.fsp.usp.br/~jmpsouza
> [email protected]
>  
> 
> *
> *   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/
> 

-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.


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