[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: date(s1,s2) leads to no values

From   Nick Cox <>
Subject   Re: st: date(s1,s2) leads to no values
Date   Thu, 25 Sep 2008 08:58:56 -0500

As Rich Goldstein suggested, the user-written program -todate- from SSC is one solution for your problem. However, Rich did not suggest following with -tostring- and I can't see that to be a good idea. Once you have an integer date variable, the natural thing to do is to format it as a date variable. Indeed -todate- has an option to do that.


Fabian Brenner

But Richard's solution did work.
-todate statpers_as_string, gen(num_date) p(yyyymmdd)-
-tostring num_date-

Richard Goldstein

If I remember correctly, version 8 could not deal with run-together
like this

download the -todate- file from ssc (when connected to the internet,
-ssc install todate- on the Stata command line)

Fabian Brenner

variable "date" is str8   %9s (one example:19861230). I would like to
gen begin=date(date,"YMD") to get elapsed dates but stata does not put
values in variable "begin" (only missings).

I use stata 8.
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index