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: Coverting variable to date and time


From   Neophytos Stylianou <neophytos.stylianou@postgrad.manchester.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Coverting variable to date and time
Date   Fri, 24 May 2013 10:45:40 +0000

Nick I have some more questions about time and date.

I have read through the help file but it is not clear to me what is the difference of %tc and %tC

I have converted my data to YMDhms and it works

Just for my practise I have also split the variable and converted the two splits into date and time variable form strings

I have entries for the same date but for morning as well as afternoon.

How will I separate them in AM and PM?

Is it something like:
Gen time2= AM if time1 >=00:00:00 & time1<=12:00:00
Replace time2=PM if time1>12:00:00 &time1<00:00:00

Thnaks
Neo

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 24 May 2013 11:00
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Coverting variable to date and time

That is no problem: it is in many ways the easiest and best way to import dates and/or  times into Stata.



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