How to remove duplicated records\observations WITHOUT sorting in SAS?

前端 未结 8 1785
孤独总比滥情好
孤独总比滥情好 2021-02-08 14:21

I wonder if there is a way to unduplicate records WITHOUT sorting?Sometimes, I want to keep original order and just want to remove duplicated records.

I

8条回答
  •  情话喂你
    2021-02-08 15:03

    This is the fastest way I can think of. It requires no sorting.

    data output_data_name;
        set input_data_name (
            sortedby = person_id stay
            keep =
                person_id
                stay
                ... more variables ...);
        by person_id stay;
        if first.stay > 0 then output;
    run;
    

提交回复
热议问题