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]
st: AW: Graph Plots with Date-Time
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: AW: Graph Plots with Date-Time
Date
Fri, 28 May 2010 16:10:37 +0200
<>
" Is there an easy way to drop observations when time is on the half-hour (1:30, 2:30, etc.)?"
Use -drop if substr(time,-2,2)=="30"-.
*************
clear*
input str15 time cdconc ws wd t
"5/19/2010 13:00" .077 2 60 24.1
"5/19/2010 13:30" .077 1.9 58 24.5
"5/19/2010 14:00" .006 1.8 46 24.8
"5/19/2010 14:30" .006 1.6 14 25.9
"5/19/2010 15:00" .008 1.8 30 26.2
"5/19/2010 15:30" .008 1.6 33 26.9
"5/19/2010 16:00" .006 1.8 21 27.1
"5/19/2010 16:30" .006 1.6 20 27.3
"5/19/2010 17:00" .007 1.5 35 27.6
"5/19/2010 17:30" .007 1.8 53 27.2
"5/19/2010 18:00" .005 1.6 35 27
"5/19/2010 18:30" .005 1.8 48 26.4
"5/19/2010 19:00" 0 1.4 36 25.8
"5/19/2010 19:30" 0 1.1 37 24.7
"5/19/2010 20:00" .014 1 31 23.2
"5/19/2010 20:30" .014 .9 33 22.2
"5/19/2010 21:00" .004 .8 41 21.6
"5/19/2010 21:30" .004 .6 35 20.9
"5/19/2010 22:00" 0 .7 33 20.4
"5/19/2010 22:30" 0 .7 44 20
"5/19/2010 23:00" .007 .5 357 19.2
"5/19/2010 23:30" .007 .4 351 19
end
list, noo
drop if substr(time,-2,2)=="30"
list, noo
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von [email protected]
Gesendet: Freitag, 28. Mai 2010 16:01
An: Statalist
Betreff: st: Graph Plots with Date-Time
Serial number: 30110532867
Licensed to: Reginald C. Jordan
v.11 updated on WinXP
Here is a partial dataset that I am attempting to work with:
time cdconc ws wd t
5/19/2010 13:00 .077 2 60 24.1
5/19/2010 13:30 .077 1.9 58 24.5
5/19/2010 14:00 .006 1.8 46 24.8
5/19/2010 14:30 .006 1.6 14 25.9
5/19/2010 15:00 .008 1.8 30 26.2
5/19/2010 15:30 .008 1.6 33 26.9
5/19/2010 16:00 .006 1.8 21 27.1
5/19/2010 16:30 .006 1.6 20 27.3
5/19/2010 17:00 .007 1.5 35 27.6
5/19/2010 17:30 .007 1.8 53 27.2
5/19/2010 18:00 .005 1.6 35 27
5/19/2010 18:30 .005 1.8 48 26.4
5/19/2010 19:00 0 1.4 36 25.8
5/19/2010 19:30 0 1.1 37 24.7
5/19/2010 20:00 .014 1 31 23.2
5/19/2010 20:30 .014 .9 33 22.2
5/19/2010 21:00 .004 .8 41 21.6
5/19/2010 21:30 .004 .6 35 20.9
5/19/2010 22:00 0 .7 33 20.4
5/19/2010 22:30 0 .7 44 20
5/19/2010 23:00 .007 .5 357 19.2
5/19/2010 23:30 .007 .4 351 19
var label type format
time Time str15 %15s
cdconc Cdconc float %9.0g
ws WS float %9.0g
wd WD int %8.0g
t T float %9.0g
Questions
1. Is there an easy way to drop observations when time is on the half-hour (1:30, 2:30, etc.)?
2. Ultimately, what I want to do is plot cdconc vs time, where time is 12AM, 3AM, 6AM, 9AM, etc. Does time need to be converted from a string variable and date-time formatted first? I've read through Cox,Getting nice time-of-day labels on a graph, SJ, February 2003, revised September 2003, but I don't know exactly how this helps me.
3. In general, do you need to separate date and time before doing this sort of plot (cdconc vs. time)? If you do, how do you format the time part?
Thanks much.
*
* 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/