Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: `x' notation

From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: `x' notation
Date   Mon, 24 Oct 2005 23:19:42 +0200

Terra wrote:

I have a forvalues loop I'm trying to run:
forvalues x=1989(1)2005 {
  forvalues y=1(1)12 {
   if `x'==2005 & `y'>8 continue
And when I run that I get the following error:
det ambiguous abbreviation
end of do-file
After some experimenting I know that the problem lies in
the(det`launchdatemo'`launchdateyr') part.  I need the denominator to refer
to, for example, the variable det11989 if launchdate (one of my variables)
for that observation is equal 1/1/1989.  I have created two variables,
launchdatemo and launchdateyr which are the launch date month and year,
respectively. That's what I'm trying to refer to in the denominator above....

It looks as if you try to handle launchdatemo and launchdateyr as macros,
but according to your description they are variables. Try a debug.
Before running your commands:
   . set trace on
   . set tracedepth 1
and see what happens. This lets check whether your macros expanded to what
you expected. In this case `launchdatemo' and `launchdateyr' probably
expanded to nothing, hence the error message on det being an ambiguous

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, work:  +45 8942 6090
Phone, home:  +45 8693 7796
Fax:          +45 8613 1580

*   For searches and help try:

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