🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Quartz | Level 8

Calculating %RSD of many variable at once

My data has dimension of 80x200

patients in rows and variables in column.

I want  to calculate the %RSD of each variable.

%RSD= (standard deviation of each variable / mean of variable)*100

The data looks  like this:

ID,gender,AL,BK,MS,DF
2,F,13.4,7.3,-15.2,9.2
3,M,12.1,5.1,17.2,8.85
5,M,10.8,2.9,49.6,8.5
7,F,9.5,0.7,82,8.15
Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Diamond | Level 26

Re: Calculating %RSD of many variable at once

This is essentially what SAS calls the CV (coefficient of variation) except it is not multiplied by 100.

``````proc summary data=have;
var al bk ms df;
output out=cv cv=/autoname;
run;``````
--
Paige Miller
4 REPLIES 4
Diamond | Level 26

Re: Calculating %RSD of many variable at once

This is essentially what SAS calls the CV (coefficient of variation) except it is not multiplied by 100.

``````proc summary data=have;
var al bk ms df;
output out=cv cv=/autoname;
run;``````
--
Paige Miller
Quartz | Level 8

Re: Calculating %RSD of many variable at once

My data has 200 variables. I need that on all of them.

Diamond | Level 26

Re: Calculating %RSD of many variable at once

Use a list of consecutive variables names, such as

al--bk

where al is the first variable name and bk is the last variable name; the double dash indicates that the variables in the list are consecutive.

--
Paige Miller
Super User

Re: Calculating %RSD of many variable at once

``````proc summary data=have;
var _numeric_;
output out=cv cv=/autoname;
run;``````

Using _numeric_ will run it on all numeric variables.

@Job04 wrote:

My data has 200 variables. I need that on all of them.

Discussion stats
• 4 replies
• 547 views
• 1 like
• 3 in conversation