Statalist


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

RE: st: Problem with forvalues option


From   "Rajesh Tharyan" <R.Tharyan@exeter.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Problem with forvalues option
Date   Thu, 27 Mar 2008 14:25:53 -0000

Hi,

Not the answer to your question  .. Nevertheless, I found the user written
ado called stats (STB insert (STB-3 sed5.) by Paul Banens) quite useful for
this sort of thing.

In stata type

.findit stats

Hope this helps
rajesh


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Margaret R Grove
Sent: 27 March 2008 13:35
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Problem with forvalues option

I'm not certain, but if I understand this correctly, I think you would get
the same count for each record.  You could add the "by" variable below or
you could do a "collapse"

*****Create new variable which counts # of service types utilized by
child's id by year
forvalues id = 114603/304057{
forvalues year = 2004/2007{
egen stypno`id' `year' = count(servtype), by(id year)
lab var styno "number of service types utilized each child per year"
}
}

Meg

Josiane Georges wrote:
> I can't get the following code to work:
>
> *****Create new variable which counts # of service types utilized by
> child's id by year
> forvalues id = 114603/304057{
> forvalues year = 2004/2007{
> egen stypno`id' `year' = count(servtype)
> lab var styno "number of service types utilized each child per year"
> }
> }
>
> What have I done wrong?
>
>
>
> 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: jgeorges@health.nyc.gov
> 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/
>   

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index