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

James

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.

Phil





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.


==========================================

James Harris

National Centre for Epidemiology and Population Health
The Australian National University
CANBERRA ACT 0200
Australia

*
* 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/
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
http://www.public-health.adelaide.edu.au/
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:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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