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

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


-----Original Message-----
From: Levy Lee []
Sent: 06 September 2004 08:59
Subject: st: how PC works 

Dear listers,

    please test the following code:

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


    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?



*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index