BookmarkSubscribeRSS Feed
igsteo
Calcite | Level 5

 

 

I have used proc rank 'group=5'. Based on the 'varrank', how do i sort the data such that each table lists 'CY' variables under each rank per dsname grouping?

i.e. i have data from work.yr16 to yr20.

 

Thank you for the assistance!

 

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Please post more of your data and what you want the result to look like.

 

Makes it much easier to help you.

igsteo
Calcite | Level 5
proc rank  data=iglib.mktcap6yrs groups=5
   out=rankedME;
   by dsname;
   var CY;
   ranks varrank;
run;

apologies, here are the codes

igsteo
Calcite | Level 5

I'm not sure how to convert the data into datalines. i have a few hundred datalines. 

Kurt_Bremser
Super User

My third footnote links to a macro that converts datasets to data step code.

 

A simple data step for your dataset will look like this:

data mktcap6yrs;
length
  reits $8
  cy 8
  dsname $41
  me_group 8
;
input
  reits
  cy
  dsname
  me_group
;
datalines;
AAREIT 834849900 WORK.YR16 1
;

Add additional datalines as needed to illustrate your task.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 531 views
  • 0 likes
  • 3 in conversation