<>
I am sure there is an easier way to achieve this...
*******
clear*
input str24 var1
"Sep/09/1998 08:42:00 PM"
end
g var2=word(var1,-1)
g var3=word(var1,2)
g var4=clock(var3, "hms")
g var5=hh(var4)
g var6=string(var5)+" "+ var2
drop var2-var5
l
*******
HTH
Martin
_______________________
----- Original Message -----
From: <[email protected]>
To: <[email protected]>
Sent: Monday, February 23, 2009 8:37 PM
Subject: st: Extracting Time from Excel Sheet
I want to extract the time from v1
Sep/09/1998 08:42:00 PM
where v1 is
str24 %24s
However, all I can extract is
08:42:00 PM
when using substr.
I would like to extract the hours (eg 8) and PM or AM.
Any suggestions?
*
* 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/