sas variable difference with same id -


i appreciate lot guys, when got problems modulating sas.

i have data set follows.

id          key      score  10002817 200207826243 0  10002817 200207826271 0  10002817 200208532180 0  10002976 200301583978 0  10003685 200302311690 0  10006588 200401613047 0  10006588 200502882618 0  10009377 201007510866 1  10009377 201111777969 0  10011044 200801328219 2  10011044 200803290654 3  10011044 200803290728 1  10011044 200803290905 1  10011044 200803291161 0 

sometimes id repeated in data or not. want see maximum difference in score according id. is, form followings.

id    key   score  diff_score 10002817 200207826243 0 0 10002817 200207826271 0 0 10002817 200208532180 0 0 10002976 200301583978 0 0 10003685 200302311690 0 0 10006588 200401613047 0 0 10006588 200502882618 0 0 10009377 201007510866 1 1 10009377 201111777969 0 1 10011044 200801328219 2 3 10011044 200803290654 3 3 10011044 200803290728 1 3 10011044 200803290905 1 3 10011044 200803291161 0 3 

how can make sas?

it helpful if me. thank all.

you can using proc sql:

proc sql;   create table want    select id, key, score, max(score)-min(score) diff_score   have   group id; quit; 

one of advantages of using proc sql data doesn't need sorted work.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -