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

Re: st: Re: A small technique problem


From   "Maoyong Fan" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Re: A small technique problem
Date   Fri, 11 Jun 2004 13:04:23 -0700

Dear Michael,

	The first method works very well!  Thank you!
	The second method does not work.  Error: dum* invalid name	

Warm regards,

Maoyong Fan 				

>There a a couple of ways to do this:
>
>1)  don't have any other variables that begin with "dum" or choose a
>different stub for the dummies, then you could just write:
>
>local varlist_2 = "verbal_sat dum*"
>
>2) Use the r(r) that tells you the number of dummies:
>
>local varlist_2 = "verbal_sat dum1-dum`r(r)'"
>
>Michael Blasnik
>[email protected]
>
>
>----- Original Message ----- 
>From: "Maoyong Fan" <[email protected]>
>To: "statalist" <[email protected]>
>Sent: Friday, June 11, 2004 3:35 PM
>Subject: st: A small technique problem
>
>
>> Dear Statalist members,
>>
>> I met a small stata problem.  Does anyone have a good way to do it?
>>
>> Problem:
>>
>> The subprogram is like this:
>>
>> load big data set
>> select small data set
>> generate dum
>> show how many dum variables are generated
>> loop to operate on each dum
>>
>> In total, there are over fifty such small subprograms, every small data
>set is different from the other.
>>
>> I have to check how many dums are there in the subprogram and put the
>number into loop.  Everytime, I change the big dataset, I have to recheck
>the dum number and reinput the dum number into the loop.
>>
>> How can I let the stata do this automatically?
>>
>> Example of subprogram:
>> use pdp_matching.dta, clear
>>
>
><snip>
>
>>
>> tabulate same_class, gen(dum)
>>
>> di r(r)
>>
>> local varlist_1 = "gender math_sat"
>> local varlist_2 = "verbal_sat dum1-dum30"
>>
>> Note:  I have to input 30 by myself before!!!  Can stata do this
>automatically?
>>
><snip>
>
>> Warm regards,
>>
>> Maoyong Fan
>
>
>*
>*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index