SDA 4.1 Documentation for SREPORT FUNCTIONS


NAME

sreport functions - functions and formats used by SREPORT

DESCRIPTION

The functions and formats listed below are recognized in command files and templates by the SREPORT program. Full descriptions of their use are given in the documentation for the batch version of SREPORT.

The name of each function can be given in either upper or lower case. Some function names can be abbreviated. The minimum required name is given below in upper case; the characters in lower case are optional and are ignored by the program.

MEANING OF FUNCTION ARGUMENTS

In the following lists of functions the arguments given as examples have the following meaning:

&a,&b
Reference to a variable (generated by a statement such as `&a=age')

c-g
Numbers (codes for the values of variables)

&x,&y,&z
Most general type of argument - can be a reference to a variable, the result of a function, or a numeric constant

The term valid in the following definitions means that the value of a variable is not equal to the missing-data code nor is it beyond the defined range of valid codes.


TYPES OF FUNCTIONS


FUNCTIONS USED FOR DEFINING VARIABLES

There are four kinds of functions that can be used with input variables. Note that a ROWVAR type of report can only use the first kind (arithmetic functions).

1. Arithmetic functions

MEAN(&a) Mean MAXimum(&a) Maximum valid value MINimum(&a) Minimum valid value STDDEV(&a) Standard deviation STDERR(&a) Standard error SUM(&a) Sum of a variable across cases Nvalid(&a) Number of valid cases VARiance(&a) Variance WNvalid(&a) Weighted number of valid cases WSTDERR(&a) Standard error, computed with weighted N
The functions `wnvalid' and `wstderr' generate the same numbers as `nvalid' and `stderr' if no weight variable has been specified.

In a ROWVARS type of report, only the function name is given; it applies automatically to every row variable.

2. Frequencies

FREQuency(&a,c-d,e,f-g) Number of cases that fall within the given ranges of `&a'. BIFREQuency(&a,c-d; &b,e-f,g) Number of cases that fall within the given ranges of BOTH variables. NOTICE THE SEMICOLON, used to separate the ranges of the two variables.
The character `*' used as the range of a variable refers to all valid codes. If a weight variable has been specified, the number of cases is weighted.

3. Percentages

COLPCTN(&m)
The column or vertical percent based on the NUMBER OF CASES in a column. The argument `&m' can be either a reference to a variable (produced by a statement such as `&m=age') or the result of a FREQUENCY or BIFREQUENCY command (produced by a series of statements such as `&a=age' and `&m=FREQ(&a,18-30)').

COLPCTSUM(&a)
The column or vertical percent based on the SUM OF THE VALUES of the variable given as the argument.

ROWPCT(&x,&y)
The row or horizontal percent based on the values of the two arguments. This function divides the first argument by the second argument and multiplies by 100: &x / &y * 100.

4. Functions of Aggregates

The following functions operate on the aggregated values of variables or functions, within categories of the break variable.
ADD(&x,&y,&z,...) Add the arguments SUBtract(&x,&y) Subtract: &x - &y MULTiply(&x,&y,&z,...) Multiply the arguments DIVide(&x,&y) Divide: &x / &y AVerage(&x,&y,&z,...) Average (mean) of the arguments GReat(&x,&y,&z,...) The greatest argument (e.g., great(2,4,6) = 6) LEast(&x,&y,&z,...) The smallest argument (e.g., least(2,4,6) = 2) SQRT(&x) Square root of argument

FUNCTIONS FOR COLUMN SPECIFICATIONS

&cat The category code of the break variable &clabel The label of the category code &name The name of each row variable &label The long label of each row variable

FORMAT SPECIFICATIONS FOR ROWS AND TOTALS

Numeric formats (All can include decimal points; numbers are rounded to fit.)
XXXXXX Whole number, no decimal points XXX.XX Number of decimal points specified XX,XXX Comma(s) inserted as needed (The comma can appear anywhere in the format) $X,XXX Dollar sign and comma(s) XXXXX% Percent sign put at the end of the number (XXXX) Parentheses put around the number (The number part of the format can be any of the above)
Text formats
CCCCCC Centered text LLLLLL Left-justified text RRRRRR Right-justified text
Format to suppress a field
BBBBBB Blank out the field (numeric or text) (used to blank out a field in a row or a total)

FUNCTIONS FOR HEADERS AND FOOTERS

&DATE Current date, in form: July 15, 1993 &PAGE Page number within the report &NAME Name of the break variable &LABel Long label of the break variable &FILter Name of filter variable(s) and codes &WEIght Name of the weight variable &DATA Name of ascii data file(s) used as input &DDL Name of DDL file &a Name of variable referred to as `&a' (if &a=age, the string `age' will be substituted)

FUNCTIONS FOR INTERACTIVE REPORTS

&say message
Display "message" on the screen. If no message is specified, a blank line is produced.

&prompt
Use a standard prompt to obtain data (can be used with any keyword or reference to a variable)

&ask message
Alternative to `&prompt', if you want to customize the prompt for the user. Display "message," input a line of text, and pass the input to one of the keywords.

SEE ALSO

sreport Basic information about SREPORT
sreport batch Commands for batch mode of SREPORT
sreport examples Examples of SREPORT command files
DDL Data Description Language


CSM, UC Berkeley/ISA
March 18, 2019