BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mblack-732
Fluorite | Level 6

Hello!

I'm trying to create a new variable that is a "standardized" response of the original variable... that is every observation had a response value for a variable (for the sake of this question, that variable's name is "old"). Is there a way to create a new variable (called "new") such that

new observation response = (old observation response * mean old response)/standard deviation of old response

I understand that I can find these numbers by running a proc means and inputting them into these formulas... but then I have to round. Is there a way to do it without that?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@mblack-732 wrote:

Hi! Thank you for your response! Is there a way in proc standardize for it to be multiplied by mean and then divided by the standard deviation (not just standardized by mean)? what is the specific command for that?

 

Thanks again!


Please read the documentation for Proc STDIZE. There are lots of options:

METHOD= option.

 

Table 106.2: Available Standardization Methods

Method

Location

Scale

MEAN

Mean

1

MEDIAN

Median

1

SUM

0

Sum

EUCLEN

0

Euclidean length

USTD

0

Standard deviation about origin

STD

Mean

Standard deviation

RANGE

Minimum

Range

MIDRANGE

Midrange

Range/2

MAXABS

0

Maximum absolute value

IQR

Median

Interquartile range

MAD

Median

Median absolute deviation from median

ABW(c)

Biweight one-step M-estimate

Biweight A-estimate

AHUBER(c)

Huber one-step M-estimate

Huber A-estimate

AWAVE(c)

Wave one-step M-estimate

Wave A-estimate

AGK(p)

Mean

AGK estimate (ACECLUS)

SPACING(p)

Mid-minimum spacing

Minimum spacing

L(p)

L(p)

L(p)

IN(ds)

Read from data set

Read from data set

 

STD is what you are asking for. This is the default if no METHOD= option is provided.

View solution in original post

4 REPLIES 4
ballardw
Super User

Sounds like you want Proc STDIZE. It has many standardization methods.

 

And example:

proc stdize data=sashelp.class out=work.classstd
     oprefix
     sprefix=new
     method=mean;
     var height;
run;

This standardizes Height using the mean. The Oprefix option keeps the original variable (Height), sprefix prefixes any standardized variable names with the prefix "new", creating newheight. If you have multiple variables on the var statement then you would have the original variable and a "new" standardized version for each.

If neither the Oprefix or Sprefix is used the output standardized variable will have the original variable name. If you omit Oprefix but use Sprefix to name a new variable the original variable is not n the output data. The Oprefix can also add a prefix to the original variable using Oprefix=Old for example.

novinosrin
Tourmaline | Level 20

Sir @ballardw  Thank you for the notes. Super and priceless:)

mblack-732
Fluorite | Level 6

Hi! Thank you for your response! Is there a way in proc standardize for it to be multiplied by mean and then divided by the standard deviation (not just standardized by mean)? what is the specific command for that?

 

Thanks again!

ballardw
Super User

@mblack-732 wrote:

Hi! Thank you for your response! Is there a way in proc standardize for it to be multiplied by mean and then divided by the standard deviation (not just standardized by mean)? what is the specific command for that?

 

Thanks again!


Please read the documentation for Proc STDIZE. There are lots of options:

METHOD= option.

 

Table 106.2: Available Standardization Methods

Method

Location

Scale

MEAN

Mean

1

MEDIAN

Median

1

SUM

0

Sum

EUCLEN

0

Euclidean length

USTD

0

Standard deviation about origin

STD

Mean

Standard deviation

RANGE

Minimum

Range

MIDRANGE

Midrange

Range/2

MAXABS

0

Maximum absolute value

IQR

Median

Interquartile range

MAD

Median

Median absolute deviation from median

ABW(c)

Biweight one-step M-estimate

Biweight A-estimate

AHUBER(c)

Huber one-step M-estimate

Huber A-estimate

AWAVE(c)

Wave one-step M-estimate

Wave A-estimate

AGK(p)

Mean

AGK estimate (ACECLUS)

SPACING(p)

Mid-minimum spacing

Minimum spacing

L(p)

L(p)

L(p)

IN(ds)

Read from data set

Read from data set

 

STD is what you are asking for. This is the default if no METHOD= option is provided.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 2030 views
  • 1 like
  • 3 in conversation