Hi all,
I have a dataset containing fights in a school. I was asked to do some descriptive analysis, especially graphs, using the date variable to see if perhaps students fight more in a particular day of the week or hour, moth etc.
I have a date variable storage type= double; display format %tc.. ex 11:30:00 11:40:59. I need to format this variable so I can differentiate from 11 am to 11 pm or perhaps 11 and 21 hours. Although I did some quick reading on format function I did not find answer.
Then I need to create a line chart of my hour variable. My tried was histogram IncidentDate, frequenc. But I would like a line graph. I supposed this is pretty easy to do but again I did not find a way to do a line graph for a single variable (frequencies). Please find attach an example of how I would like the graph to look- the variable a I used for this graph is another date variable but it will work for the hour variable as well. .
--------------
Thank you very much!
MArvin
I have a dataset containing fights in a school. I was asked to do some descriptive analysis, especially graphs, using the date variable to see if perhaps students fight more in a particular day of the week or hour, moth etc.
I have a date variable storage type= double; display format %tc.. ex 11:30:00 11:40:59. I need to format this variable so I can differentiate from 11 am to 11 pm or perhaps 11 and 21 hours. Although I did some quick reading on format function I did not find answer.
Then I need to create a line chart of my hour variable. My tried was histogram IncidentDate, frequenc. But I would like a line graph. I supposed this is pretty easy to do but again I did not find a way to do a line graph for a single variable (frequencies). Please find attach an example of how I would like the graph to look- the variable a I used for this graph is another date variable but it will work for the hour variable as well. .
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id double IncidentTime 1 -1893406199999.9998 2 -1.8934368e+12 3 -1.8934158e+12 4 -1.8934155e+12 5 -1893414960000.0002 6 -1.8934209e+12 7 -1.8934164e+12 8 -1.8934074e+12 9 -1.8934149e+12 10 -1893410580000 11 -1.8934206e+12 12 -1893408899999.9998 13 -1.8934023e+12 14 -1.893381e+12 15 -1.8934362e+12 end format %tchh:MM:SS IncidentTime
Thank you very much!
MArvin