Statalist


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

st: Problem with date variable in a macro


From   "Josiane Georges" <[email protected]>
To   <[email protected]>
Subject   st: Problem with date variable in a macro
Date   Tue, 1 Apr 2008 13:11:12 -0400

I wrote the following macro, but got a "2004m1 invalid name" - r(198)
error. I can't figure out what I did wrong. Any ideas on how I might
debug this code?

capture program drop auth_cld 

program define auth_cld

{
use auth`1'_id, clear

gen month1 =`1'

destring month1, generate month = m(month1) replace

collapse (count) id, by (month)

rename id num_chd

label var num_chd "# unique children"

format num_chd %9.0g

save auth_cld`1', replace

}

end

auth_cld 2004m1

auth_cld 2004m2

auth_cld 2004m3

auth_cld 2004m4

auth_cld 2004m5

auth_cld 2004m6


Josiane "Josie" Georges
Analyst, Liaison to the Division of Mental Hygiene
Policy and Planning
NYC Department of Health and Mental Hygiene
Tel: 212-788-5342
Fax: 212-788-5353
Email: [email protected]
125 Worth Street, Rm 624, CN #45
New York, NY 10013
 



**********************************************************************
The New York City Department of Health & Mental Hygiene is now offering information important for the health of all New Yorkers.  To sign up for these new and valuable updates, log-on to our website at http://www.nyc.gov/health/email and select the NYC DOHMH updates you'd like to receive.

IMPORTANT NOTICE:  This email is meant only for the use of the intended recipient.  It may contain confidential information that is legally privileged or otherwise protected by law.  If you have received this communication in error, please notify me immediately by replying to this message and please delete it from your computer.  Thank you for your cooperation.


*
*   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