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.

AI Navigator GIF.gif


Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.

Check it out on Microsoft Marketplace →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2598 views
  • 0 likes
  • 3 in conversation