BookmarkSubscribeRSS Feed
Benn
Calcite | Level 5

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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 593 views
  • 0 likes
  • 1 in conversation