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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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