{smcl}
{* 18dec2003}{...}
{hline}
help for {hi:matvsort}
{hline}

{title:Sort vector}

{p 8 17 2}
{cmd:matvsort} {it:input_vector} {it:output_vector} [{cmd:,} {cmdab:dec:rease}]


{title:Description}

{p 4 4 2}
{cmd:matvsort} sorts {it:input_vector} (a 1 X {it:c} matrix or an {it:r} X 1
matrix) into numeric order and puts the resulting vector into
{it:output_vector}.  {it:input_vector} and {it:output_vector} may have the same
name. 


{title:Options}

{p 4 8 2}
{cmd:decrease} specifies that values should be in decreasing order. The
default is increasing order. 


{title:Remarks} 

{p 4 8 2}
{cmd:matvsort} may make it easier to identify the smallest or largest
element(s) of a vector. If a vector {cmd:b} has been sorted into increasing
order, its smallest element is accessible as {cmd:b[1,1]} and its largest as
{cmd:b[1,colsof(b)]} if {cmd:b} is a row vector and {cmd:b[rowsof(b),1]} if
{cmd:b} is a column vector. 

{p 4 8 2} 
The corresponding names are accessible as for example 

{p 8 8 2}{cmd: local c1name : word 1 of `: colnames b'}
    

{title:Examples}

{p 4 8 2}{cmd:. matvsort A B}


{title:Author}

{p 4 4 2}
Nicholas J. Cox, University of Durham, U.K.{break}
n.j.cox@durham.ac.uk


{title:Also see}

{p 4 13 2}
Online:  help for {help matrix}