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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: Formatting Dates


From   "Anna M. Pees" <ampees@vet.k-state.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Formatting Dates
Date   Fri, 10 Jun 2011 14:27:55 +0000

Great!   
That changed the "newage" to months.  That is what I wanted to do.  Thank you.

AMP

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Miller, Daniel P
Sent: Friday, June 10, 2011 9:17 AM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: Formatting Dates

Assuming that drawdate and birthdate are in a days format I am pretty certain that you can:

gen newage_p = Drawdate- birthdate             
gen newage = mofd(newage_p)
drop newage_p

the Stata help file (type  help dates_and_times) has a great deal of information on how to work with dates and to convert dates from one format to another


Daniel P. Miller, PhD
Assistant Professor
Human Behavior Department
Boston University School of Social Work
264 Bay State Road  |  Boston, MA 02215
617-353-3752  |  617-353-5612 (fax)  |  dpmiller@bu.edu P Please consider the environment before printing this e-mail.


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Oliver Jones
Sent: Friday, June 10, 2011 10:04 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Formatting Dates

Sorry, maybe I didn't understand your question.
Now I assume it is no problem for you to create the variable containing the age in months, e.g. by typing

generate currentage_m = newage/30.4

And now you want to format it?
What exactly do mean by that?

Best
Oliver


Am 10.06.2011 15:14, schrieb Anna M. Pees:
> How would I do that?  Sorry, so new to this.
> I can generate the new variable from the two dates but what do I use to format it?
>
> AMP
>
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Oliver 
> Jones
> Sent: Friday, June 10, 2011 8:10 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Formatting Dates
>
> Hi,
>
> why don't you create a variable holding the age in months?
>
> Best
> Oliver
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics Chair of Econometrics and Statistics
- -
Raum / room:  V9-110
Tel / phone:  +49 (0)521 106 4871
---
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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