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

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

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

Hi everyone!

Please help me!

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
Respected Advisor
Posts: 4,607

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

minValue = min(of var1-var16);

drop var1-var16;

PG

View solution in original post


All Replies
Solution
‎03-26-2017 03:01 AM
Respected Advisor
Posts: 4,607

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

minValue = min(of var1-var16);

drop var1-var16;

PG
Contributor
Posts: 41

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

Thank you!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 156 views
  • 2 likes
  • 2 in conversation