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

st: RE: set the date

From   "Nick Cox" <>
To   <>
Subject   st: RE: set the date
Date   Wed, 9 Apr 2008 21:42:05 +0100

The first lesson is to use the on-line help, but after -search- if you
don't know
what entries to look up. So 

. search double 

points to help on -data types-. 

gen var1n = date("15/" + var1, "DMY") 

var2 sounds as if it is already as you want it. It is already numeric. 

For subtraction, use -

e.g. gen var3 = var2 - var1n 

P.S. the spelling is "Stata"! 



I am new to STATA
I have 2 variables and want to set them as date with
as in the following:

1-Var1- Storage type str8, display format 0.9s. It has
month and year only like: 06/2005 . I want to assign
the day for it then set the day at 15 of each month :

2- Var2- Storage type double, display format %td and
writen like 26Nov2005. I want this to set it as date
and actualy don't know what double means.

3- Then I have to change them to numeric (var1n,
var2n) and substracte them: var3=var2n-var1n.

*   For searches and help try:

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