# Using Median and Standard Deviation in syntax

#### JW22

##### New Member
Hi,

I'm quite new to SPSS and am looking to code my data records by whether or not they are within 1 standard deviation of the median for that variable.

So far I have been doing this for each variable:

Code:
DO IF (HumanIL21Normalised GE -1.6336 AND HumanIL21Normalised LE 0.3664).
COMPUTE OutsideSD = 1.
ELSE.
COMPUTE InsideSD = 0.
END IF.
Here, (Median of HumanIL21Normalised - 1 Standard Deviation of HumanIL21Normalised) = '-1.6336' and the other value is + 1 Standard Deviation.

I want to have the syntax be able to calculate the values here without me having to manually work out the median and standard deviation. Is there a way to do this?

The purpose of this is so that I can split data into high and low groups after removing records within one standard deviation of the median.

Thanks!

#### Robert Jones

##### New Member
have a look at the AGGREGATE command in the command syntax referemce manual that should be available via SPSS help