Skip to content

bug: @egen and @collapse can not summarize over missing values in columns? #190

@gergelyattilakiss

Description

@gergelyattilakiss

When I use columns that have missing values to calculate something in a groupby it seems to throw error. E.g:
image

On the above df if I run

@with df @egen birt_year = minimum(birth_year), by(person_id)

I get

ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer

But if I run

@with df begin
       @mvencode birth_year, mv(99999)
       @egen byear = minimum(birth_year), by(person_id)
end

It throws no error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions