Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Cumulative average of categorical variables

 From Nick Cox To "statalist@hsphsun2.harvard.edu" Subject Re: st: Cumulative average of categorical variables Date Sat, 7 May 2011 12:18:15 +0100

If it's reasonable to average your categories, rounding afterwards just throws away information. (Think grade-point averages.)
```
Nick

On 7 May 2011, at 11:48, Marcello Pagano
<pagano@hsph.harvard.edu> wrote:

```
```For Luisa:

---------- Forwarded message ----------
From: Luisa Soares-Miranda<luisasoaresmiranda@gmail.com>
Date: Fri, May 6, 2011 at 12:37 PM
Subject: cumulative average of categorical variables
To: statalist@hsphsun2.harvard.edu

Dear all,

```
Can anyone tell me how should I do the cumulative average of categorical
```variables? My variable was measured in year 1, 2, 3, 4, and they are
```
categorical ( 4 categories, 0,1,2,3) , so I had use rowmedian. However in the en my final variable (the cumulative average ) comes out like this:
```
Cum_averg |      Freq.     Percent        Cum.
------------+-----------------------------------
0 |        360        6.11        6.11
.5 |        342        5.81       11.92
1 |      2,220       37.70       49.62
1.5 |        792       13.45       63.07
2 |      1,611       27.36       90.42
2.5 |        261        4.43       94.85
3 |        303        5.15      100.00
------------+-----------------------------------
Total |      5,889      100.00

```
So my problem is how do I categorize my new variable the cumulative average
```into (0,1,2,3)??? That is whys I do not know if I am doing this right.

```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```