Hello Sir/Madam,
I have a data set with bmi values and wish to covert it to Z scores. Any help.
Best,
DA
OUT=<datasetname> on the proc statement creates the output data set. By default the VAR variables are replaced by their scores.
The OPREFIX option indicates whether the original variable is kept and a prefix assigned such as OPREFIX=base would have the original value in the output set named basebmi. You can also specify a prefix for the scored value with SPREFIX, SPREFIX=zscore would have the standardized value as zscorebmi in the output set
Are you looking to use the mean and standard deviation of your data or do you need to use those from another source?
If internal to the data you could use proc stdize which will replace the variable with the standardized value in an output set. The default method is STD which produces z-scores.
I plan to use its std and mean. so I can use
proc stdize data=totalscores method=std pstat;
var total;
by Type;
run;
How do I output the z score using above statement? Is the code below correct?
proc stdize data=totalscores method=std pstat;
var total;
by Type;
output zscore=zscore;
run;
OUT=<datasetname> on the proc statement creates the output data set. By default the VAR variables are replaced by their scores.
The OPREFIX option indicates whether the original variable is kept and a prefix assigned such as OPREFIX=base would have the original value in the output set named basebmi. You can also specify a prefix for the scored value with SPREFIX, SPREFIX=zscore would have the standardized value as zscorebmi in the output set
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.