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]

st: AW: Categorising dates


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Categorising dates
Date   Tue, 24 Aug 2010 16:16:06 +0200

<> 



*************
clear*

//generate data
set obs 50
gen mydates=date("23 Sep 09", "DM20Y")+_n-26
format mydates %tdMon_dd,_CCYY

//Get day of week
tostring mydates, gen(mydays) format(%td_Dayname) force

//Get month
tostring mydates, gen(mymonth) format(%tdMonth) force


//see result
l, noo
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von sara khan
Gesendet: Dienstag, 24. August 2010 16:02
An: statalist@hsphsun2.harvard.edu
Betreff: st: Categorising dates

Dear Statalisters

I have a list of daily dates inthe format, for example, 23 Sep 09, and
need to create two variables. One is to categorise the days into
weekly data (so week commencing on a Monday). The second is to create
a variable cataegorsing the daily data into monthly data.

I would be grateful for advice on how to do this.

Many thanks.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index