next up previous contents index
Next: String-handling functions Up: [B/D] operands and operators Previous: Standard arithmetic operators

Data functions

 

The data operators described in this section all work independently of the current data selection. Thus, each data operator takes into account the maximum possible number of data cases.

Individual data cases can be accessed in equations by giving the name of the data carrier together with the case number in parenthesis - this is the same format as when the data is being defined. For example, we could have

BD>data : Patientage(3)=18 tex2html_wrap_inline33712

BD>print : (Patientage(3)) tex2html_wrap_inline33712

The argument supplied in parenthesis for the observation number may be any valid equation, which will be rounded to what should be a positive integer. A simple example is as follows.

BD>print : (Patientage(1+2)) tex2html_wrap_inline33712

It will be an error if the ``observation number'' thus supplied does not correspond to an observation. The other functions described in this section generally deal with all of the data defined over particular data carriers, rather than individual cases.

Data percentiles
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

tex2html_wrap_inline33806 tex2html_wrap_inline33806

The centile  operator gives the Ith percentile of currently selected data values on D. For example, if we order the data values as tex2html_wrap_inline43802 , then tex2html_wrap_inline43804 is the smallest value such that at least tex2html_wrap_inline43806 of the values are less than or equal to this value, and at least tex2html_wrap_inline43808 of the values are greater than or equal to this value. The lower of two candidates is returned. Note that placing tex2html_wrap_inline33914 gives the minimum, and tex2html_wrap_inline43812 gives the maximum. All possible data cases defined for the data carrier D are taken into account.

An example of the use of the command is as follows. Suppose that Temperature is the name of a data carrier, and that we require the median. (We generate the 50 artificially to illustrate the use of equations here).

BD>print : (centile (temperature,25+25)) tex2html_wrap_inline33712

 

Sample correlations
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • scorr  operator; two arguments tex2html_wrap_inline36880 and tex2html_wrap_inline36878 in parenthesis and separated by a comma. tex2html_wrap_inline36880 and tex2html_wrap_inline36878 are data carriers.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the sample correlation between tex2html_wrap_inline36880 and tex2html_wrap_inline36878 . All possible data cases defined both for the data carrier tex2html_wrap_inline36910 and the data carrier tex2html_wrap_inline43900 are taken into account.  

Sample covariances
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • scov  operator; two arguments tex2html_wrap_inline36880 and tex2html_wrap_inline36878 in parenthesis and separated by a comma. tex2html_wrap_inline36880 and tex2html_wrap_inline36878 are data carriers.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the sample covariance between tex2html_wrap_inline36880 and tex2html_wrap_inline36878 as tex2html_wrap_inline35682 times the sum of cross product deviations. All possible data cases defined both for the data carrier tex2html_wrap_inline36910 and the data carrier tex2html_wrap_inline43900 are taken into account.  

Highest data case
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • maxcase  operator; one operand D in parenthesis. D is a data carrier.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the largest case number for which there is data on the data carrier D. All possible data cases defined for the data carrier D are taken into account.  

Number of matching data cases
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • match  operator; two arguments tex2html_wrap_inline36880 and tex2html_wrap_inline36878 in parenthesis and separated by a comma. tex2html_wrap_inline36880 and tex2html_wrap_inline36878 are data carriers.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the number of cases for which there are observations on both tex2html_wrap_inline36880 and tex2html_wrap_inline36878 . All possible data cases defined both for the data carrier tex2html_wrap_inline36910 and the data carrier tex2html_wrap_inline43900 are taken into account. The match  operator is the bivariate analogue of the number  operator.  

Sample mean
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • mean  operator; one operand D in parenthesis. D is a data carrier.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the arithmetic average of the observations defined for D. All possible data cases defined for the data carrier D are taken into account. If the total number of cases is zero, or if D has not been defined, then the operator returns a value of zero and an error is reported.  

Number of data cases
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • number  operator; one operand D in parenthesis. D is a data carrier.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

returns the total number of observations for the data carrier tex2html_wrap_inline35840 . All possible data cases defined for the data carrier D are taken into account. The number  operator is the univariate analogue of the match  operator.  

Sample variances
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • svar  operator; one operand D in parenthesis. D is a data carrier.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the sample variance of D, as tex2html_wrap_inline35682 times the sum of squared deviations. All possible data cases defined for the data carrier D are taken into account.  


next up previous contents index
Next: String-handling functions Up: [B/D] operands and operators Previous: Standard arithmetic operators

David Wooff
Wed Oct 21 15:14:31 BST 1998