Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: merging floats to make dates

From   Nick Cox <>
Subject   Re: st: merging floats to make dates
Date   Wed, 4 Jan 2012 20:48:06 +0000

Your claim is quite incorrect. There is detailed documentation on
handling dates and your problem is included. The main help on dates
and times points you to the function -ym()- which can be used to
combine year and month values. For example,

. di %tm  ym(2012,1)

In your case you appear to need

. gen monthlydate = ym(var1, var2)

I don't understand what you mean by needing to use lags for this
problem. But note that in Stata "merging" overwhelmingly tends to mean
using -merge- to combine entire datasets.


On Wed, Jan 4, 2012 at 8:41 PM, micdepo mic <> wrote:
> Hello,
> I am having difficulties with dates and couldn't really find much on
> this even though it's a simple issue.
> var 1      var2    X
> 1900      1        10
> 1900       2         20
> I would like to merge these two varibles into 1900m1 etc. and not have
> to deal with lagging 12 times to get last month's X value.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index