Solved
Contributor
Posts: 59

# Pick out the smallest variable (numerical) out of a set of variables

Hi everyone!

For each observation I have 16 numerical variables (all positive numbers, for some observations not all of them have values) and I would like to pick out the smallest out of the 16 and just keep that (smallest) variable and drop the others. Do I need a do loop for this to compare 2 values at a time or is there a way to pick the smallest out of the 16 variables at once?

Thanks!!

Accepted Solutions
Solution
‎03-26-2017 03:01 AM
Posts: 5,523

## Re: Pick out the smallest variable (numerical) out of a set of variables

minValue = min(of var1-var16);

drop var1-var16;

PG

All Replies
Solution
‎03-26-2017 03:01 AM
Posts: 5,523

## Re: Pick out the smallest variable (numerical) out of a set of variables

minValue = min(of var1-var16);

drop var1-var16;

PG
Contributor
Posts: 59

## Re: Pick out the smallest variable (numerical) out of a set of variables

Thank you!

☑ This topic is solved.