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
gen
mktgprof`y'`x'=(det`y'`x')/(det`launchdatemo'`launchdateyr')
}
}
And when I run that I get the following error:
det ambiguous abbreviation
r(111);
end of do-file
r(111);
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
abbreviation.
Hope this helps
Svend
________________________________________________________
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
E-mail: sj@soci.au.dk
_________________________________________________________
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/