# st: RE: egen problem ? (was: poverty decomposition using povdeco command)

 From "Nick Cox" <[email protected]> To <[email protected]> Subject st: RE: egen problem ? (was: poverty decomposition using povdeco command) Date Tue, 19 Jul 2005 14:16:04 +0100

```I don't understand how -povdeco- is involved here.

As far as your -egen- call is concerned, the programming
manual is not needed, but just the help for -egen-.

egen sume = sum(gear_ratio*displacement*length)/displ[1] , by(for)

is illegal. You can't put arbitrary expressions on the RHS of
an -egen- call. You can, in this case, put an expression
inside the call to -sum()-

sum(<here>)

but not outside

sum(      )<illegal>

Remember the -sum()- here is an -egen- function, not the -sum()-
function.

Nick
[email protected]

[email protected]

> Ousmane has recently raised a problem using povdeco.
> In fact, his program crashes when egen is invoked.
> In his code, all previous egen calculus went fine expect for a special
> sum to be computed.
> I was able to reproduce the problem using auto data.
> However, I am not a so good programmer, so I seek the community's
> help.
> Suppose we have the fancy sum to compute. Here is the result.
>
> . clear
> . sysuse auto
> (1978 Automobile Data)
> . se tr on
> .
> .
> . egen sume = sum(gear_ratio*displacement*length)/displ[1] , by(for)
>
>
>
> I do not why the last syntax is not going through.
> And I do not have the programming
> manual to find a solution.

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