Do you want something like this?
forval i = 0(5)30 {
label define riskintvl `i' "`i'-`=`i'+4'", add
}
label define riskintval 35 "35-", add
Nick
[email protected]
David L. Winter, HNC
> I have used -stset- and then -stsplit- on my (large) datasets:
>
> Stsplit riskintvl, at (0,5,10,15,20,25,30,35)
>
> Using -tab- on the created variable riskintvl gives :
>
> Risk |
> Interval | Freq
> ------------------
> 0 | .....
> 5 | .....
> 10 | .....
> 15 | .....
> 20 | .....
> 25 | .....
> 30 | .....
> 35 | .....
>
> Is there any way that I can automatically produce labels for
> the values
> of riskintvl that encompass the range of values within each cell
> (value[n] - (1-value[n+1]) i.e
>
> 0-4, 5-9, 10-14, 15-19, 20-24, 25-29, 30-34, 35-
>
> I would be useful to do this for any definition of variables produced
> using -stsplit-
*
* 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/