# st: RE: how PC works

 From "David Harrison" To Subject st: RE: how PC works Date Mon, 6 Sep 2004 09:09:20 +0100

```And indeed all your values are between 0 and 100 as promised (they just happen to all be less than .2).

You can see that the resulting values are percentages because they sum to 100 (1000*.1).

No single observation in the variable x is supplying more than 0.2% of the total of x. You can confirm this from the summarize command by observing that the maximum of x is about 1 and the sum of x is about 500.

In this instance, the -egen- command is equivalent to

summ x
gen pc=100*x/r(sum)

Hope this helps

David
david@icnarc.org

-----Original Message-----
From: Levy Lee [mailto:chtl@econ.hku.hk]
Sent: 06 September 2004 08:59
To: statalist@hsphsun2.harvard.edu
Subject: st: how PC works

Dear listers,

clear
set obs 1000
gen x = uniform()
egen pc = pc(x)

sum

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
x |      1000    .5019275     .291899   .0007097   .9980542
pc |      1000          .1    .0581556   .0001414   .1988443

the above code generate a variable "pc", which is distributed between 0 and
.20, i do not know why? as the help file told me that the new variable
should be between 0 and 100.

Can you tell me the reason? is it a bug of stata?

thanks

Levy

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