How write the proc sort as a proc sql in SAS.

by Irina 30. July 2007 12:02
data new; 
input system $ findings $ visit $; 
cards; 
car abnormal base 
car abnormal base 
car normal base 
car normal eot 
car normal eot 
resp abnormal base 
resp abnormal base 
resp abnormal base 
resp abnormal eot 
resp normal eot 
resp normal eot 
; 
run; 

PROC SORT VERSION:

proc sort nodupkey data=new out=res_nodup;
   by system   findings;
   run;

PROC SQL VERSION:

  proc sql;
   create table res_nodup_sql as
   select system,
   findings,
   visit,
   monotonic() As row_numb ,
   min(calculated row_numb) as indicator
   from new
   group by 1,2
   having row_numb=indicator ;
   quit;

Tags: sort, sort_sql

SAS

About the author

Irina Spivak Irina Spivak
Team Leader at G-Stat. More...


Send mail Email

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2012

    Sign in

    eXTReMe Tracker