Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Formatting Dates


From   "Anna M. Pees" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Formatting Dates
Date   Fri, 10 Jun 2011 15:43:38 +0000

I'm still not understanding how to do this.

I have generated a new age that is in days, and I want it to display in years and months.  Could someone send me a link that explains how to do this?  I don't find the stata help section helpful.

Thanks for all the help.

~AMP

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Lachenbruch, Peter
Sent: Friday, June 10, 2011 10:26 AM
To: '[email protected]'
Subject: RE: st: Formatting Dates

Read help for dates and times.  Also read the help on format.  

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Anna M. Pees
Sent: Friday, June 10, 2011 7:48 AM
To: [email protected]
Subject: RE: st: Formatting Dates

One last question:

I tried looking this up but couldn't find information.

What if I want the "newage" in years and months?  How could I do this?


~AMP

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Miller, Daniel P
Sent: Friday, June 10, 2011 9:17 AM
To: [email protected]
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)  |  [email protected] P Please consider the environment before printing this e-mail.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Oliver Jones
Sent: Friday, June 10, 2011 10:04 AM
To: [email protected]
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: [email protected]
> [mailto:[email protected]] On Behalf Of Oliver 
> Jones
> Sent: Friday, June 10, 2011 8:10 AM
> To: [email protected]
> 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/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index