Mathematical Expressions
************************

Some PSPP commands use expressions, which share a common syntax among all PSPP commands.  Expressions are made up of operands, which can be numbers, strings, or variable names, separated by operators.  There are five types of operators: grouping, arithmetic, logical, relational, and functions.

Every operator takes one or more arguments as input and produces or returns exactly one result as output.  Both strings and numeric values can be used as arguments and are produced as results, but each operator accepts only specific combinations of numeric and string values as arguments.  With few exceptions, operator arguments may be full-fledged expressions in themselves.

Boolean Values
==============

Some PSPP operators and expressions work with Boolean values, which represent true/false conditions.  Booleans have only three possible values: 0 (false), 1 (true), and system-missing (unknown). System-missing is neither true nor false and indicates that the true value is unknown.

Boolean-typed operands or function arguments must take on one of these three values.  Other values are considered false, but cause an error when the expression is evaluated.

Strings and Booleans are not compatible, and neither may be used in place of the other.

Missing Values in Expressions
=============================

String missing values are not treated specially in expressions.  Most numeric operators return system-missing when given system-missing arguments.  Exceptions are listed under particular operator descriptions.

User-missing values for numeric variables are always transformed into the system-missing value, except inside the arguments  to the VALUE and SYSMIS functions.

The missing-value functions can be used to precisely control how missing values are treated in expressions.  See Missing Value Functions, for more details.

Grouping Operators
==================

Parentheses (()) are the grouping operators.  Surround an expression with parentheses to force early evaluation.

Parentheses also surround the arguments to functions, but in that situation they act as punctuators, not as operators.

Arithmetic Operators
====================

The arithmetic operators take numeric arguments and produce numeric results.

A + B
     Adds A and B, returning the sum.

A - B
     Subtracts B from A, returning the difference.

A * B
     Multiplies A and B, returning the product.

A / B
     Divides A by B, returning the quotient.  If B is zero, the result is system-missing.

A ** B
     Returns the result of raising A to the power B.  If A is negative and B is not an integer, the result is system-missing.  The result of 0**0 is system-missing as well.

- A
     Reverses the sign of A.

Logical Operators
=================

The logical operators take logical arguments and produce logical results, meaning ``true or false''.  PSPP logical operators are not true Boolean operators because they may also result in a system-missing value.

A AND B
A & B
     True if both A and B are true, false otherwise.  If one argument is false, the result is false even if the other is missing.  If both arguments are missing, the result is missing.

A OR B
A | B
     True if at least one of A and B is true.  If one argument is true, the result is true even if the other argument is missing.  If both arguments are missing, the result is missing.

NOT A
~ A
     True if A is false.  If the argument is missing, then the result is missing.

Relational Operators
====================

The relational operators take numeric or string arguments and produce Boolean results.

Strings cannot be compared to numbers.  When strings of different lengths are compared, the shorter string is right-padded with spaces to match the length of the longer string.

The results of string comparisons, other than tests for equality or inequality, are dependent on the character set in use.  String comparisons are case-sensitive.

A EQ B
A = B
     True if A is equal to B.

A LE B
A <= B
     True if A is less than or equal to B.

A LT B
A < B
     True if A is less than B.

A GE B
A >= B
     True if A is greater than or equal to B.

A GT B
A > B
     True if A is greater than B.

A NE B
A ~= B
A <> B
     True is A is not equal to B.

Functions
=========

PSPP functions provide mathematical abilities above and beyond those possible using simple operators.  Functions have a common syntax: each is composed of a function name followed by a left parenthesis, one or more arguments, and a right parenthesis.  Function names are not reserved; their names are specially treated only when followed by a left parenthesis: EXP(10) refers to the constant value e raised to the 10th power, but EXP by itself refers to the value of variable EXP.

The sections below describe each function in detail.

Advanced Mathematical Functions
-------------------------------

Advanced mathematical functions take numeric arguments and produce numeric results.

 -- Function: EXP (EXPONENT)
     Returns e (approximately 2.71828) raised to power EXPONENT.

 -- Function: LG10 (NUMBER)
     Takes the base-10 logarithm of NUMBER.  If NUMBER is not positive, the result is system-missing.

 -- Function: LN (NUMBER)
     Takes the base-e logarithm of NUMBER.  If NUMBER is not positive, the result is system-missing.

 -- Function: SQRT (NUMBER)
     Takes the square root of NUMBER.  If NUMBER is negative, the result is system-missing.

Miscellaneous Mathematical Functions
------------------------------------

Miscellaneous mathematical functions take numeric arguments and produce numeric results.

 -- Function: ABS (NUMBER)
     Results in the absolute value of NUMBER.

 -- Function: MOD (NUMERATOR, DENOMINATOR)
     Returns the remainder (modulus) of NUMERATOR divided by DENOMINATOR.  If DENOMINATOR is 0, the result is system-missing.  However, if NUMERATOR is 0 and DENOMINATOR is system-missing, the result is 0.

 -- Function: MOD10 (NUMBER)
     Returns the remainder when NUMBER is divided by 10.  If NUMBER is negative, MOD10(NUMBER) is negative or zero.

 -- Function: RND (NUMBER)
     Takes the absolute value of NUMBER and rounds it to an integer. Then, if NUMBER was negative originally, negates the result.

 -- Function: TRUNC (NUMBER)
     Discards the fractional part of NUMBER; that is, rounds NUMBER towards zero.

Trigonometric Functions
-----------------------

Trigonometric functions take numeric arguments and produce numeric results.

 -- Function: ARCOS (NUMBER)
     Takes the arccosine, in radians, of NUMBER.  Results in system-missing if NUMBER is not between -1 and 1.

 -- Function: ARSIN (NUMBER)
     Takes the arcsine, in radians, of NUMBER.  Results in system-missing if NUMBER is not between -1 and 1 inclusive.

 -- Function: ARTAN (NUMBER)
     Takes the arctangent, in radians, of NUMBER.

 -- Function: COS (ANGLE)
     Takes the cosine of ANGLE which should be in radians.

 -- Function: SIN (ANGLE)
     Takes the sine of ANGLE which should be in radians.

 -- Function: TAN (ANGLE)
     Takes the tangent of ANGLE which should be in radians. Results in system-missing at values of ANGLE that are too close to odd multiples of pi/2. Portability: none.

Missing-Value Functions
-----------------------

Missing-value functions take various numeric arguments and yield various types of results.  Note that the normal rules of evaluation apply within expression arguments to these functions.  In particular, user-missing values for numeric variables are converted to system-missing values.

 -- Function: MISSING (EXPR)
     Returns 1 if EXPR has the system-missing value, 0 otherwise.

 -- Function: NMISS (EXPR [, EXPR]...)
     Each argument must be a numeric expression.  Returns the number of system-missing values in the list.  As a special extension, the syntax VAR1 TO VAR2 may be used to refer to a range of variables; see Sets of Variables, for more details.

 -- Function: NVALID (EXPR [, EXPR]...)
     Each argument must be a numeric expression.  Returns the number of values in the list that are not system-missing.  As a special extension, the syntax VAR1 TO VAR2 may be used to refer to a range of variables; see Sets of Variables, for more details.

 -- Function: SYSMIS (EXPR)
     When EXPR is simply the name of a numeric variable, returns 1 if the variable has the system-missing value, 0 if it is user-missing or not missing.  If given EXPR takes another form, results in 1 if the value is system-missing, 0 otherwise.

 -- Function: VALUE (VARIABLE)
     Prevents the user-missing values of VARIABLE from being transformed into system-missing values, and always results in the actual value of VARIABLE, whether it is user-missing, system-missing or not missing at all.

Pseudo-Random Number Generation Functions
-----------------------------------------

Pseudo-random number generation functions take numeric arguments and produce numeric results.

PSPP uses the alleged RC4 cipher as a pseudo-random number generator (PRNG).  The bytes output by this PRNG are system-independent for a given random seed, but differences in endianness and floating-point formats will make PRNG results differ from system to system.  RC4 should produce high-quality random numbers for simulation purposes. (If you're concerned about the quality of the random number generator, well, you're using a statistical processing package---analyze it!)

PSPP's implementation of RC4 has not undergone any security auditing. Furthermore, various precautions that would be necessary for secure operation, such as secure seeding and discarding the first several bytes of output, have not been taken.  Therefore, PSPP's implementation of RC4 should not be used for security purposes.

 -- Function: NORMAL (NUMBER)
     Results in a random number.  Results from NORMAL are normally distributed with a mean of 0 and a standard deviation of NUMBER.

 -- Function: UNIFORM (NUMBER)
     Results in a random number between 0 and NUMBER.  Results from UNIFORM are evenly distributed across its entire range.  There may be a maximum on the largest random number ever generated---this is often 2**31-1 (2,147,483,647), but it may be orders of magnitude higher or lower.

Set-Membership Functions
------------------------

Set membership functions determine whether a value is a member of a set. They take a set of numeric arguments or a set of string arguments, and produce Boolean results.

String comparisons are performed according to the rules given in Relational Operators.

 -- Function: ANY (VALUE, SET [, SET]...)
     Results in true if VALUE is equal to any of the SET values.  Otherwise, results in false.  If VALUE is system-missing, returns system-missing.  System-missing values in SET do not cause ANY to return system-missing.

 -- Function: RANGE (VALUE, LOW, HIGH [, LOW, HIGH]...)
     Results in true if VALUE is in any of the intervals bounded by LOW and HIGH inclusive.  Otherwise, results in false. Each LOW must be less than or equal to its corresponding HIGH value.  LOW and HIGH must be given in pairs. If VALUE is system-missing, returns system-missing. System-missing values in SET do not cause RANGE to return system-missing.

Statistical Functions
---------------------

Statistical functions compute descriptive statistics on a list of values.  Some statistics can be computed on numeric or string values; other can only be computed on numeric values.  Their results have the same type as their arguments.  The current case's weighting factor (see WEIGHT) has no effect on statistical functions.

With statistical functions it is possible to specify a minimum number of non-missing arguments for the function to be evaluated.  To do so, append a dot and the number to the function name.  For instance, to specify a minimum of three valid arguments to the MEAN function, use the name MEAN.3.

 -- Function: CFVAR (NUMBER, NUMBER[, ...])
     Results in the coefficient of variation of the values of NUMBER. This function requires at least two valid arguments to give a non-missing result.  (The coefficient of variation is the standard deviation divided by the mean.)

 -- Function: MAX (VALUE, VALUE[, ...])
     Results in the value of the greatest VALUE.  The VALUEs may be numeric or string.  Although at least two arguments must be given, only one need be valid for MAX to give a non-missing result.

 -- Function: MEAN (NUMBER, NUMBER[, ...])
     Results in the mean of the values of NUMBER.  Although at least two arguments must be given, only one need be valid for MEAN to give a non-missing result.

 -- Function: MIN (NUMBER, NUMBER[, ...])
     Results in the value of the least VALUE.  The VALUEs may be numeric or string.  Although at least two arguments must be given, only one need be valid for MAX to give a non-missing result.

 -- Function: SD (NUMBER, NUMBER[, ...])
     Results in the standard deviation of the values of NUMBER. This function requires at least two valid arguments to give a non-missing result.

 -- Function: SUM (NUMBER, NUMBER[, ...])
     Results in the sum of the values of NUMBER.  Although at least two arguments must be given, only one need by valid for SUM to give a non-missing result.

 -- Function: VARIANCE (NUMBER, NUMBER[, ...])
     Results in the variance of the values of NUMBER.  This function requires at least two valid arguments to give a non-missing result.

String Functions
----------------

String functions take various arguments and return various results.

 -- Function: CONCAT (STRING, STRING[, ...])
     Returns a string consisting of each STRING in sequence. CONCAT("abc", "def", "ghi") has a value of "abcdefghi". The resultant string is truncated to a maximum of 255 characters.

 -- Function: INDEX (HAYSTACK, NEEDLE)
     Returns a positive integer indicating the position of the first occurrence NEEDLE in HAYSTACK.  Returns 0 if HAYSTACK does not contain NEEDLE.  Returns system-missing if NEEDLE is an empty string.

 -- Function: INDEX (HAYSTACK, NEEDLE, DIVISOR)
     Divides NEEDLE into parts, each with length DIVISOR. Searches HAYSTACK for the first occurrence of each part, and returns the smallest value.  Returns 0 if HAYSTACK does not contain any part in NEEDLE.  It is an error if DIVISOR cannot be evenly divided into the length of NEEDLE.  Returns system-missing if NEEDLE is an empty string.

 -- Function: LENGTH (STRING)
     Returns the number of characters in STRING.

 -- Function: LOWER (STRING)
     Returns a string identical to STRING except that all uppercase letters are changed to lowercase letters.  The definitions of ``uppercase'' and ``lowercase'' are system-dependent.

 -- Function: LPAD (STRING, LENGTH)
     If STRING is at least LENGTH characters in length, returns STRING unchanged.  Otherwise, returns STRING padded with spaces on the left side to length LENGTH.  Returns an empty string if LENGTH is system-missing, negative, or greater than 255.

 -- Function: LPAD (STRING, LENGTH, PADDING)
     If STRING is at least LENGTH characters in length, returns STRING unchanged.  Otherwise, returns STRING padded with PADDING on the left side to length LENGTH.  Returns an empty string if LENGTH is system-missing, negative, or greater than 255, or if PADDING does not contain exactly one character.

 -- Function: LTRIM (STRING)
     Returns STRING, after removing leading spaces.  Other whitespace, such as tabs, carriage returns, line feeds, and vertical tabs, is not removed.

 -- Function: LTRIM (STRING, PADDING)
     Returns STRING, after removing leading PADDING characters. If PADDING does not contain exactly one character, returns an empty string.

 -- Function: NUMBER (STRING, FORMAT)
     Returns the number produced when STRING is interpreted according to format specifier FORMAT.  If the format width W is less than the length of STRING, then only the first W characters in STRING are used, e.g. NUMBER("123", F3.0) and NUMBER("1234", F3.0) both have value 123.  If W is greater than STRING's length, then it is treated as if it were right-padded with spaces.  If STRING is not in the correct format for FORMAT, system-missing is returned.

 -- Function: RINDEX (STRING, FORMAT)
     Returns a positive integer indicating the position of the last occurrence of NEEDLE in HAYSTACK.  Returns 0 if HAYSTACK does not contain NEEDLE.  Returns system-missing if NEEDLE is an empty string.

 -- Function: RINDEX (HAYSTACK, NEEDLE, DIVISOR)
     Divides NEEDLE into parts, each with length DIVISOR. Searches HAYSTACK for the last occurrence of each part, and returns the largest value.  Returns 0 if HAYSTACK does not contain any part in NEEDLE.  It is an error if DIVISOR cannot be evenly divided into the length of NEEDLE.  Returns system-missing if NEEDLE is an empty string.

 -- Function: RPAD (STRING, LENGTH)
     If STRING is at least LENGTH characters in length, returns STRING unchanged.  Otherwise, returns STRING padded with spaces on the right to length LENGTH.  Returns an empty string if LENGTH is system-missing, negative, or greater than 255.

 -- Function: RPAD (STRING, LENGTH, PADDING)
     If STRING is at least LENGTH characters in length, returns STRING unchanged.  Otherwise, returns STRING padded with PADDING on the right to length LENGTH.  Returns an empty string if LENGTH is system-missing, negative, or greater than 255, or if PADDING does not contain exactly one character.

 -- Function: RTRIM (STRING)
     Returns STRING, after removing trailing spaces.  Other types of whitespace are not removed.

 -- Function: RTRIM (STRING, PADDING)
     Returns STRING, after removing trailing PADDING characters. If PADDING does not contain exactly one character, returns an empty string.

 -- Function: STRING (NUMBER, FORMAT)
     Returns a string corresponding to NUMBER in the format given by format specifier FORMAT.  For example, STRING(123.56, F5.1) has the value "123.6".

 -- Function: SUBSTR (STRING, START)
     Returns a string consisting of the value of STRING from position START onward.  Returns an empty string if START is system-missing or has a value less than 1 or greater than the number of characters in STRING.

 -- Function: SUBSTR (STRING, START, COUNT)
     Returns a string consisting of the first COUNT characters from STRING beginning at position START.  Returns an empty string if START or COUNT is system-missing, if START is less than 1 or greater than the number of characters in STRING, or if COUNT is less than 1.  Returns a string shorter than COUNT characters if START + COUNT - 1 is greater than the number of characters in STRING.  Examples: SUBSTR("abcdefg", 3, 2) has value "cd"; SUBSTR("Ben Pfaff", 5, 10) has the value "Pfaff".

 -- Function: UPCASE (STRING)
     Returns STRING, changing lowercase letters to uppercase letters.

Time & Date Functions
---------------------

The legal range of dates for use in PSPP is 15 Oct 1582 through 31 Dec 19999.

     Please note: Most time & date extraction functions will accept invalid arguments:

       * Negative numbers in PSPP time format.

       * Numbers less than 86,400 in PSPP date format.

     However, sensible results are not guaranteed for these invalid values. The given equivalents for these functions are definitely not guaranteed for invalid values.

     Please note also: The time & date construction functions do produce reasonable and useful results for out-of-range values; these are not considered invalid.

How times & dates are defined and represented
.............................................

Times and dates are handled by PSPP as single numbers.  A time is an interval.  PSPP measures times in seconds. Thus, the following intervals correspond with the numeric values given:

               10 minutes                        600
               1 hour                          3,600
               1 day, 3 hours, 10 seconds     97,210
               40 days                     3,456,000
               10010 d, 14 min, 24 s     864,864,864

A date, on the other hand, is a particular instant in the past or the future.  PSPP represents a date as a number of seconds after the midnight that separated 8 Oct 1582 and 9 Oct 1582.  (Please note that 15 Oct 1582 immediately followed 9 Oct 1582.)  Thus, the midnights before the dates given below correspond with the numeric PSPP dates given:

                   15 Oct 1582                86,400
                    4 Jul 1776         6,113,318,400
                    1 Jan 1900        10,010,390,400
                    1 Oct 1978        12,495,427,200
                   24 Aug 1995        13,028,601,600

Please note:

  * A time may be added to, or subtracted from, a date, resulting in a date.

  * The difference of two dates may be taken, resulting in a time.

  * Two times may be added to, or subtracted from, each other, resulting in a time.

(Adding two dates does not produce a useful result.)

Since times and dates are merely numbers, the ordinary addition and subtraction operators are employed for these purposes.

     Please note: Many dates and times have extremely large values---just look at the values above.  Thus, it is not a good idea to take powers of these values; also, the accuracy of some procedures may be affected.  If necessary, convert times or dates in seconds to some other unit, like days or years, before performing analysis.

Functions that Produce Times
............................

These functions take numeric arguments and produce numeric results in PSPP time format.

 -- Function: TIME.DAYS (NDAYS)
     Results in a time value corresponding to NDAYS days. (TIME.DAYS(X) is equivalent to X * 60 * 60 * 24.)

 -- Function: TIME.HMS (NHOURS, NMINS, NSECS)
     Results in a time value corresponding to NHOURS hours, NMINS minutes, and NSECS seconds.  (TIME.HMS(H, M, S) is equivalent to H*60*60 + M*60 + S.)

Functions that Examine Times
............................

These functions take numeric arguments in PSPP time format and give numeric results.

 -- Function: CTIME.DAYS (TIME)
     Results in the number of days and fractional days in TIME. (CTIME.DAYS(X) is equivalent to X/60/60/24.)

 -- Function: CTIME.HOURS (TIME)
     Results in the number of hours and fractional hours in TIME. (CTIME.HOURS(X) is equivalent to X/60/60.)

 -- Function: CTIME.MINUTES (TIME)
     Results in the number of minutes and fractional minutes in TIME. (CTIME.MINUTES(X) is equivalent to X/60.)

 -- Function: CTIME.SECONDS (TIME)
     Results in the number of seconds and fractional seconds in TIME. (CTIME.SECONDS does nothing; CTIME.SECONDS(X) is equivalent to X.)

Functions that Produce Dates
............................

These functions take numeric arguments and give numeric results in the PSPP date format.  Arguments taken by these functions are:

day
     Refers to a day of the month between 1 and 31.

month
     Refers to a month of the year between 1 and 12.

quarter
     Refers to a quarter of the year between 1 and 4.  The quarters of the year begin on the first days of months 1, 4, 7, and 10.

week
     Refers to a week of the year between 1 and 53.

yday
     Refers to a day of the year between 1 and 366.

year
     Refers to a year between 1582 and 19999.

If these functions' arguments are out-of-range, they are correctly normalized before conversion to date format.  Non-integers are rounded toward zero.

 -- Function: DATE.DMY (DAY, MONTH, YEAR)
 -- Function: DATE.MDY (MONTH, DAY, YEAR)
     Results in a date value corresponding to the midnight before day DAY of month MONTH of year YEAR.

 -- Function: DATE.MOYR (MONTH, YEAR)
     Results in a date value corresponding to the midnight before the first day of month MONTH of year YEAR.

 -- Function: DATE.QYR (QUARTER, YEAR)
     Results in a date value corresponding to the midnight before the first day of quarter QUARTER of year YEAR.

 -- Function: DATE.WKYR (WEEK, YEAR)
     Results in a date value corresponding to the midnight before the first day of week WEEK of year YEAR.

 -- Function: DATE.YRDAY (YEAR, YDAY)
     Results in a date value corresponding to the midnight before day YDAY of year YEAR.

Functions that Examine Dates
............................

These functions take numeric arguments in PSPP date or time format and give numeric results.  These names are used for arguments:

date
     A numeric value in PSPP date format.

time
     A numeric value in PSPP time format.

time-or-date
     A numeric value in PSPP time or date format.

 -- Function: XDATE.DATE (TIME-OR-DATE)
     For a time, results in the time corresponding to the number of whole days DATE-OR-TIME includes.  For a date, results in the date corresponding to the latest midnight at or before DATE-OR-TIME; that is, gives the date that DATE-OR-TIME is in. (XDATE.DATE(X) is equivalent to TRUNC(X/86400)*86400.) Applying this function to a time is a non-portable feature.

 -- Function: XDATE.HOUR (TIME-OR-DATE)
     For a time, results in the number of whole hours beyond the number of whole days represented by DATE-OR-TIME.  For a date, results in the hour (as an integer between 0 and 23) corresponding to DATE-OR-TIME.  (XDATE.HOUR(X) is equivalent to MOD(TRUNC(X/3600),24))  Applying this function to a time is a non-portable feature.

 -- Function: XDATE.JDAY (DATE)
     Results in the day of the year (as an integer between 1 and 366) corresponding to DATE.

 -- Function: XDATE.MDAY (DATE)
     Results in the day of the month (as an integer between 1 and 31) corresponding to DATE.

 -- Function: XDATE.MINUTE (TIME-OR-DATE)
     Results in the number of minutes (as an integer between 0 and 59) after the last hour in TIME-OR-DATE.  (XDATE.MINUTE(X) is equivalent to MOD(TRUNC(X/60),60)) Applying this function to a time is a non-portable feature.

 -- Function: XDATE.MONTH (DATE)
     Results in the month of the year (as an integer between 1 and 12) corresponding to DATE.

 -- Function: XDATE.QUARTER (DATE)
     Results in the quarter of the year (as an integer between 1 and 4) corresponding to DATE.

 -- Function: XDATE.SECOND (TIME-OR-DATE)
     Results in the number of whole seconds after the last whole minute (as an integer between 0 and 59) in TIME-OR-DATE. (XDATE.SECOND(X) is equivalent to MOD(X, 60).)  Applying this function to a time is a non-portable feature.

 -- Function: XDATE.TDAY (TIME)
     Results in the number of whole days (as an integer) in TIME. (XDATE.TDAY(X) is equivalent to TRUNC(X/86400).)

 -- Function: XDATE.TIME (DATE)
     Results in the time of day at the instant corresponding to DATE, in PSPP time format.  This is the number of seconds since midnight on the day corresponding to DATE.  (XDATE.TIME(X) is equivalent to TRUNC(X/86400)*86400.)

 -- Function: XDATE.WEEK (DATE)
     Results in the week of the year (as an integer between 1 and 53) corresponding to DATE.

 -- Function: XDATE.WKDAY (DATE)
     Results in the day of week (as an integer between 1 and 7) corresponding to DATE.  The days of the week are:

     1
          Sunday

     2
          Monday

     3
          Tuesday

     4
          Wednesday

     5
          Thursday

     6
          Friday

     7
          Saturday

 -- Function: XDATE.YEAR (DATE)
     Returns the year (as an integer between 1582 and 19999) corresponding to DATE.

Miscellaneous Functions
-----------------------

Miscellaneous functions take various arguments and produce various results.

 -- Function: LAG (VARIABLE)
     VARIABLE must be a numeric or string variable name.  LAG results in the value of that variable for the case before the current one.  In case-selection procedures, LAG results in the value of the variable for the last case selected.  Results in system-missing (for numeric variables) or blanks (for string variables) for the first case or before any cases are selected.

 -- Function: LAG (VARIABLE, NCASES)
     VARIABLE must be a numeric or string variable name.  NCASES must be a small positive constant integer, although there is no explicit limit.  (Use of a large value for NCASES will increase memory consumption, since PSPP must keep NCASES cases in memory.) LAG (VARIABLE, NCASES results in the value of VARIABLE that is NCASES before the case currently being processed.  See LAG (VARIABLE) above for more details.

 -- Function: YRMODA (YEAR, MONTH, DAY)
     YEAR is a year between 0 and 199 or 1582 and 19999.  MONTH is a month between 1 and 12.  DAY is a day between 1 and 31.  If MONTH or DAY is out-of-range, it changes the next higher unit.  For instance, a DAY of 0 refers to the last day of the previous month, and a MONTH of 13 refers to the first month of the next year.  YEAR must be in range.  If YEAR is between 0 and 199, 1900 is added.  YEAR, MONTH, and DAY must all be integers.

     YRMODA results in the number of days between 15 Oct 1582 and the date specified, plus one.  The date passed to YRMODA must be on or after 15 Oct 1582.  15 Oct 1582 has a value of 1.

Functions Not Implemented
-------------------------

These functions are not yet implemented and thus not yet documented, since it's a hassle.

  * CDF.xxx

  * CDFNORM

  * IDF.xxx

  * NCDF.xxx

  * PROBIT

  * RV.xxx

Operator Precedence
===================

The following table describes operator precedence.  Smaller-numbered levels in the table have higher precedence.  Within a level, operations are performed from left to right, except for level 2 (exponentiation), where operations are performed from right to left.  If an operator appears in the table in two places (-), the first occurrence is unary, the second is binary.

 1. (  )

 2. **

 3. -

 4. *  /

 5. +  -

 6. EQ  GE  GT  LE  LT  NE

 7. AND  NOT  OR