Help using Base SAS procedures

Proc Rank- Disapperance of Rank 0

Reply
Contributor
Posts: 35

Proc Rank- Disapperance of Rank 0

Hi Guys,

I was using the PROC RANK procedure, and realized something weird that happened:

In some sets, the Rank 0 was not assigned and in other cases it was assigned.  To give you all a clearer idea, the following are my codes that led up to the disappearance:

/*Forming Absent IO List (Those without any Institional Ownership)*/

PROC SQL NOPRINT;

CREATE TABLE ABSENT_IO_LIST

AS SELECT * FROM CRSPCOMMON_LIST

EXCEPT

SELECT * FROM PRESENT_IO_LIST;

/*Creating New Variable: 'IO' in the Absent IO List and Assigning it a value of 0/

DATA ABSENT_IO_LIST;

SET ABSENT_IO_LIST;

IO=0;

RUN;

/*Forming IO Dataset*/

DATA IO;

SET FACTOR;

KEEP RDATE CUSIP IO;

RUN;

/*Forming Complete IO Dataset*/

DATA COMPLETE_IO;

SET IO ABSENT_IO_LIST;

RUN;

/*Finding the IO for each stock for each Quarter*/

PROC MEANS

DATA= COMPLETE_IO;

CLASS RDATE CUSIP;

VAR IO;

OUTPUT OUT=SUM_IO

N=N

SUM(IO)=SUM_IO;

RUN;

DATA SUM_IO;

SET SUM_IO;

IF _TYPE_<3 THEN DELETE;

RUN;

/*Forming Quintiles on the Report Date*/

PROC SORT DATA=SUM_IO OUT=SUM_IO;

BY RDATE SUM_IO;

RUN;

PROC RANK

DATA=SUM_IO  OUT=SUM_IO  Groups=5;

BY RDATE;

VAR SUM_IO;

RANKS R_IO;

RUN;

I have also attached the SUM_IO dat file for you all to view. For eg. it is funny how in RDATE=19800331, the only ranks seen are 1,2,3,4 whereas on some other dates, such as 19841231, the rank 0 is present

Please help! Thanks guys!

Ask a Question
Discussion stats
  • 0 replies
  • 130 views
  • 0 likes
  • 1 in conversation