Start with -help date- obviously, but try this:
g numdate=date(yourdate,"ydm",2020)
g year=year(numdate)
g month=month(numdate)
g day=day(numdate)
g day_of_week=dow(numdate)
and try to use language _much_ more carefully. What you describe has
_nothing_ to do with writing programs in Stata, and I am sure you do
not have "dates that are represented in string format that indicate
the year, date, and the month" but may have "dates that are
represented in string format that indicate the year, day, and the
month." If you had sent the attached message in the first place, with
a descriptive subject line like "converting dates in string format" or
somesuch, you would have gotten help right away, I suspect, even
though you should have started with online help (-help date- is more
than obvious, really). If you post enough poorly framed questions,
you run the risk of people ignoring your future questions, so read the
FAQ at http://www.stata.com/support/statalist/faq and follow the
rules: try -help- and -findit- and seach the archives first, then
specify what you've tried, and in what version of Stata (type -about-
for version details) on what platform.
On 2/25/06, Sriram Narayanan <[email protected]> wrote:
> basically I have dates that are represented in string
> format that indicate the year, date, and the month in
> that order like 'xxxxx' I need to convert them into
> proper dates like 'xx/xx/xxxx' so that I can
> manipulate them. Then I want to work with the dates to
> get many other parameters I need for by a given
> date/week/month/year from there.
>
> thanks.
>
> sriram
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/