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

Re: st: RE: if "macro" == value {

From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: RE: if "macro" == value {
Date   Tue, 03 Feb 2004 17:36:58 +1030


From your output it looks like the exposure() option of -poisson- _is_ recognising `population' as a variable name, the return error message even says it does; it's just that pop25m is a string variable and exposure() won't take a string var as its argument. Presumably, if you did a:

. describe pop25m

on your data set, you would see pop25m is of type string? The -list- command is not choosey; it will list pop25m whether it be string or numeric.


I have a question related to the one answered above. In the following code, all works well up until line 8 (the poisson command), which returns
exposure(): pop25m: string variable not allowed

1 foreach ICD in i21 {
2 foreach age in 25 35 45 {
3 foreach sex in m f {
4 local deaths = "`ICD'_`age'`sex'"
5 local population = "pop`age'`sex'"
6 macro list
7 list year `ICD'_`age'`sex' pop`age'`sex' `deaths' `population'
8 poisson `deaths' year, exposure (`population')
9 }
10 }
11 }

In other words, it appears that the list command interprets the local macro `population' as a varname, but the exposure() part of the poisson command does not.

Any comments gratefully received.

with thanks,



James Harris

National Centre for Epidemiology and Population Health
The Australian National University

* For searches and help try:
Philip Ryan
Associate Professor,
Department of Public Health
Associate Dean (Information Technology)
Faculty of Health Sciences
University of Adelaide 5005
South Australia
tel 61 8 8303 3570
fax 61 8 8223 4075
CRICOS Provider Number 00123M
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.

*   For searches and help try:

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