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

Re: st: Calculating date giving syntax error

From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: Calculating date giving syntax error
Date   Mon, 13 Aug 2007 12:40:26 +0200

Ziad wrote:

I am trying to calculate age of patients it gives 'type mismatch
error' (r(109)) for both of the following commands:

gen momage=scrndte-dobmom


gen momage=(scrndte-dobmom)/365.25


Apparently at least one of the variables -scrndte- and -dobmom-
is a string variable, so subtraction is an illegal action.

You can see the variable type by -descriptives-.

Hope this helps


Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796

*   For searches and help try:

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