BookmarkSubscribeRSS Feed
emikea
Calcite | Level 5

Suppose I have the dataset below. Is there a function or technique that would allow me to scale each variable from 1 to 100 based upon user-defined (not actual) minimum and maximum values for each variable, respectively? For instance, I'd like a variable called Ratio_1_std that would score ratio_1 variables based upon how far they are into the range from 0 to 50. And I'd like a variable called Ratio_2_std that would score ratio_2 from 0 to 100 based upon a different range, perhaps 5 to 55. Values below the minimum and maximum provided would get scores of 1 and 100, respectively. I can simply code the desired results manually for each variable, but I'm looking for a potential function or technique that will do this based upon parameters I provide for each variable to minimize coding and to more easily apply this technique to many variables.

DATA WORK.TEMP;

INPUT ID RATIO_1 RATIO_2;

DATALINES;

1 25 50

2 5  10

;

RUN;

2 REPLIES 2
Reeza
Super User

Try Proc stdize and/or call stdize.

Proc if your standardizing down a column and call stdize if its across columns, i.e. a row.

Haikuo
Onyx | Level 15

Still not sure if I have understand what you are after, it would be great if you can lay out some sample outcome based on your input data. But I have a feeling that you may want to check out PROC FCMP or DS2 custom method or simply PROC FORMAT.

Haikuo

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1555 views
  • 0 likes
  • 3 in conversation