The ACCESS command allows variables contained in a saveset to be
loaded into SST only when the data is needed by SST. The variables will
appear in listings as if they exist in memory but the data will not be
loaded until it is actually needed by SST. Any variables that already
exist in memory will be overwritten. If no file extension is present in
filename, .sav is assumed.
By default, the length of the current observation range used by SST is
set to the length of the largest variable accessed from a saveset. This
action is not performed if the current observation range has been set
explicitly with the RANGE command.
Additionally, the ACCESS command
will never set the current range to a length less than that set by
a previous LOAD or ACCESS
command. The auto range feature can be enabled and disabled using the
command CONFIG RANGE[auto=on|off].
SST savesets can be created with the SAVE command. SST savesets
can also be read with the LOAD command. The only difference in
ACCESS and LOAD is that the latter brings all variables
into memory at once. LOAD minimizes interactive computing time,
but may require significant startup time.
TAPE subop can be used in place of FILE to optimize
saveset access for sequential access devices such as tape drives. This
subop also results in some savings in memory usage at the expense of
speed when used with random access devices.
TO subop must agree with the
number listed in the VAR subop.
TO subop.
SST1> ACCESS FILE[bkw] # access all variables in bkw.sav
SST2> ACCESS FILE[bkw] VAR[pop15] TO[abc] # access variable 'pop15' as 'abc'
SST3> LIST # access variables marked by '+'
---- Variables ----
abc 50+ Wed Jul 26 20:32:06 1989 percentage population under 15
deldpi 50+ Wed Jul 26 20:32:06 1989 real disposable income growth rate
dpi 50+ Wed Jul 26 20:32:06 1989 real disposable income per capita
pop15 50+ Wed Jul 26 20:32:06 1989 percentage population under 15
pop75 50+ Wed Jul 26 20:32:06 1989 percentage population over 75
sr 50+ Wed Jul 26 20:32:06 1989 average personal savings rate
SST4> CALC mean(pop15-abc)
0.00000e+000
SST5> LIST
---- Variables ----
abc 50 Wed Jul 26 20:32:06 1989 percentage population under 15
deldpi 50+ Wed Jul 26 20:32:06 1989 real disposable income growth rate
dpi 50+ Wed Jul 26 20:32:06 1989 real disposable income per capita
pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15
pop75 50+ Wed Jul 26 20:32:06 1989 percentage population over 75
sr 50+ Wed Jul 26 20:32:06 1989 average personal savings rate
The AGGREGATE command forms counts, means, sums, or standard
deviations of variables by specified categories in the population.
It can be used for Analysis of Variance calculations, and to form
statistics for various sub-samples.
VAR subop, a corresponding variable name
must be specified in the TO subop. Observations on the variables
in the TO subop will be calculated using groups of observations
on the input variable in the VAR subop.
AGGREGATE omits observations for which there is any
missing data in the VAR variable list. If BYVAR is
present, then an observation is omitted for a variable only if that
variable is missing.
expression
is true.
KEY is present, then each variable in the TO list has
a length equal to the number of levels of the BY variable, and
the argument of KEY is a variable list giving the category
levels of the BY variables. The length of the variable list
in KEY must equal the length of the variable list in BY.
If KEY is absent, then the variables in the TO list are
the same length as the variables in the VAR list, with the
categorical summary in each observation in the corresponding category.
faminc, for households in
diffrent regions, region:
Obsno faminc region
1: 10.00000 1.00000
2: 20.00000 1.00000
3: 15.00000 2.00000
4: 20.00000 2.00000
5: 25.00000 2.00000
The command
AGGREGATE VAR[faminc] BY[region] TO[avinc] KEY[newreg]
would compute mean income for each of the two regions:
Obsno avinc newreg
1: 15.00000 1.00000
2: 20.00000 2.00000
The ARRAY command is used to define an array of values.
For example
ARRAY name = (value1 value2 ... valueN)
The array name is any valid SST identifier. The value of an element of the array can be any string; it should be separated from other values by a space or a comma (below we describe how to embed spaces and commas in a single element of an array variable). If an array has only a single value the parenthesis can be omitted. We can create a variable with no value by omitting everything after the equal sign (including the equal sign itself). Here are some valid array declarations; the third creates a null array:
ARRAY list = (pop15, pop75, dpi) ARRAY single = this is a single array element ARRAY flag ARRAY quote = (pop15,"this is a single array element")
To recall a array, we use the array metacharacter -- the dollar sign
($). Array substitution behaves much like simple macro substitution,
the array is "expanded", replacing the array reference. Since the
array has many values associated with it, we must specify the element
of the array we would like to retrieve. A general array reference has
the following form:
$variable_name[index]
The index is used to specify the elements of the array which should be
extracted. It can either be a single integer ($name[3]), a range of
integers ($name[1-4]) or an open ended range ($name[2-]).
This last form will extract the second to the last elements of the array
name. If only the array name appears ($name), all the values
of the array separated by spaces are substituted. Consider the following
example:
SST1> array list = (one, dos, tres, 4, ivefay) SST2> echo One element: $list[3] One element: tres SST3> echo All elements: $list All elements: one dos tres 4 ivefay SST4> echo Some elements: $list[3-] Some elements: tres 4 ivefay
It is often necessary to determine the size of an array. To do this we
use an array reference of the form $#name. When SST encounters
this reference it will replace it by the number of elements in the
array name (this array must exist). As an example, let's write
a command file to calculate a two stage least squares with any number
of exogenous variables:
# reg2.cmd - calculate a two stage regression
# Usage: RUN reg2(y1, y2, x_vars, z_vars)
# $1 $2 $3 $4
# Set up some arrays to act on
array y1 = $1
array y2 = $2
array x_vars = ($3) # exogenous variables
array z_vars = ($4) # instruments
reg dep[$y2] ind[$x_vars $z_vars] pred[y2hat]
reg dep[$y1] ind[y2hat $x_vars] coef[b2sls]
# Calculate the error
set ls2_err = y1 - b2sls(1)*y2
foreach (i; {1-$#x_vars2) {
set ls2_err = sl2_err - b2sls($i+1) * $x_vars[$i]
}
calc stdev(e2sls)
As each command in the command file is executed the values of the arrays
are substituted in place of the array references. This substitution does
not occur until the commands are actually executed. Thus array references
within the body of a loop are not expanded until the loop is actually
executed (and not just defined). Also notice that array references are
allowed inside the subscripts of an array reference, as in
`$x_vars[$i]'. The array i will first be expanded to determine
which element of x_vars to retrieve. The entire reference will then
be replaced by that element of x_vars.
Now lets take a look at some of the other functions that the array mechanism can perform. The following table is a summary:
Reference Value
--------- -----
$#name The number of words in the array "name"
$?name "1" if the array "name" exists, "0" otherwise
$0 The name of the current command file
$1, $2, ... The arguments specified for this command file
$* All command file arguments separated by spaces
$< Reads a single line of input from the terminal
$(expr) Evaluates "expr" using CALC and substitutes the result
For example $(PI) converts the representation of the
string '3.1416..' to a floating point number that can
then be used in subops like DOMAIN.
$'s1, s2' "1" if the strings s1 and s2 are equal, "0" otherwise
$^varname Unique values of an SST variable, in sorted order,
separated by spaces
It is often necessary to use an array in a location where it's meaning
might be ambiguous. For example, suppose that we would like to expand
a array i and immediately follow it by the word data.
The obvious array reference, $idata, is indistinguishable from
the expansion for a array with the name idata. In such cases
the array reference can be surrounded by braces to delimit it from
surrounding text. So our desired reference would become
${i2data
SST defines a number of internal arrays (as opposed to user
arrays) which can be accessed in the same way as user arrays. These
arrays are listed below. Note that only the status and argv arrays
appear when listed with the LIST ARRAY command. The other
arrays may listed by explicitly specifying them in the ARRAY
subop to the list command.
Name Value
---- -----
time The current time (hh:mm:ss)
version Date and time that this version of SST was created
echo Value of the CONFIG ECHO flag ("on" or "off")
verbose Value of the CONFIG VERBOSE flag ("on" or "off")
status "1" if the last command ran successfully, "0" otherwise
argv Arguments for the current command file
The status array can be set to reflect the return status of a command
file by specifying an argument to the EXIT command. This
argument must be a valid expression; the status array is set to the
value of the expression (as determined by the CALC command)
converted to an integer. If a file contains no EXIT command,
it's return status is the same as the last command executed. If the
EXIT command contains no argument, the status array is set to
1. Note that setting the status array using the ARRAY
command will not work since status will immediately be reset to the
return status of the ARRAY command (probably 1).
SST also defines some array functions which allow access to SST data and provide useful operations. The following functions are defined:
Function Value -------- ----- $strcmp(s1, s2) '1' if s1 equals s2, '0' otherwise $labels(var) list of value labels for the SST variable 'var' $values(var) sorted list of values contained in 'var' $vallab(var, value) label associated with a given value $labval(var, label) value associated with a value label $extract(s, i, j) extract a substring of s (ith through jth chars)
The autocorrelation function is computed for each variable specified in
the VAR subop for up to the number of lags specified in the
LAG subop. If the LAG subop is not present, the default
maximum is fifteen lags. This function assumes the data are equally
spaced in time, without gaps
variable
list.
expression is non-zero.
number. The default value is 15.
observation list.
PARTIAL subop is present, partial autocorrelations are
calculated in addition to autocorrelations. In both cases, a plot of
the autocorrelations is produced with + denoting the value of
the autocorrelation and parentheses indicating plus or minus one
standard deviation bounds.
To compute the first fifteen autocorrelations for the time-series `unemp':
auto var[unemp]
A bar chart of the variables specified in the VAR subop is
graphed using the observations determined by the IF and
OBS subops (if present). This command produces a bar for each
observation and variable, unless the subop STACK is present. If STACK
is present, then a stacked bar is produced for each observation. The
AGGREGATE command with the KEY subop can be used to prepare data
summaries for bar plotting.
expression
is true.
TERM must also be present unless this
has been set as an environment variable on your system.
SIZE.
terminal. See TERM.
sr and
pop15 from the BKW data set:
SST1> load file[bkw] SST2> bar var[sr pop15] by[(obsno)] obs[1-5]
A boxplot is drawn for each variable listed in the VAR subop.
The top and bottom of the box correspond to the 25th and 75th per-
centiles of the variable, the horizontal line through the box
corresponds to its median. The vertical line, or "whiskers", have ends
that extend beyond the quartiles by a distance equal to 1.5 times the
interquartile range. Approximately 99 percent of normally distributed
data will lie within the whiskers. Outliers are identified by *.
The boxplot is printed vertically with the variable name listed on the X
axis of the graph. The PARM option may be used to change the
parameters used to describe the graph.
expression
is true.
PARM subop can be used to customize the format of the
graph. For the BOXPLOT command, options which affect the X axis are
ignored. See PARM.
TERM must also be present unless this
has been set as an environment variable on your system.
SIZE.
terminal. See TERM.
SST3> LOAD FILE[bkw] #Boxplot with terminal output SST4> BOXPLOT VAR[sr dpi deldpi]
Break out of the body of a FOREACH, FOR or WHILE
loop. If more than one loop is in progress, the innermost loop is
terminated -- it is an error to issue the BREAK command outside
of a loop. More information on SST loops is given under the name of
each loop.
SST2> FOREACH (i; 1 2 3 4 5) { # Simple loop to illustrate BREAK command
1> ECHO iteration number $i
1> IF ($i>2) BREAK
1> }
iteration number 1
iteration number 2
iteration number 3
SST3>
This command forms means and standard deviations of the variable specified in the DEP subop, classified by the values of the variable given in the BY subop, and prints out the results in a convenient format. If there are several variables in BY, then all possible combinations of values of these variables are used to form the classification. The AGGREGATE command can also be used to generate classified means and standard deviations, in a form useful for construction of further variables.
expression is true.
observation list.
If an expression is typed on the command line, the expression is evaluated and the user is returned to the SST prompt. If no expression is typed on the command line, SST is placed in calculator mode. Expressions are evaluated as entered by the user until `q' or `quit' is typed at the calculator prompt. Any valid expression can be evaluated by the calculator. If a variable name is mentioned without any reference to a particular observation, the calculator assumes the first observation on the variable is to be used. An underscore can be used to retrieve the last result calculated by SST
For more information in SST expressions see the SST User's Guide.
SST1> LOAD FILE[bkw]
SST2> CALC 1/sqrt(2) # Calulation using constant data
0.70711
SST3> CALC mean(sr) # Calculate mean value of a variable
9.67100
SST4> CALC log(sr[12]) # Calculation on an individual
1.27815 # observation
SST5> CALC 2+_ # Calculation on last result
3.27815
Change the current working directory to path. If path
is not specified the name of the current directory is printed.
SST1> CD # Print the current directory
D:\sst
SST2> CD data # Go to a subdirectory
D:\sst\data
SST3> DIR
. <DIR> 7-27-89 9:52p
.. <DIR> 7-27-89 9:52p
BLACKER.DAT 796 7-26-89 8:23p
DABNEY.DAT 199 7-26-89 8:43p
FLEMING.DAT 160 3-17-87 8:00a
LLOYD.DAT 33 7-04-89 6:51p
PAGE.DAT 5 7-26-89 9:45p
RICKETTS.DAT 126 7-26-89 9:45p
RUDDOCK.DAT 14 6-26-89 10:09p
9 File(s) 316416 bytes free
SST4> CD A:/ # Return to starting point
A:\
SST5>
If no options are present all user data is destroyed. This includes
variables, functions, macros and the history and replay lists. A
specific subset of these can be cleared by using one of the options
given below. To clear specific data elements, such as a single matrix
or variable, use the DEL command.
ARRAY).
DEFINE).
SST1> LOAD FILE[bkw] SST2> DEFINE add(a,b) = a + b # Define some SST objects SST3> MACRO LS LIST SST4> LIST ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate dpi 50 Wed Jul 26 20:32:06 1989 real disposable income per capita pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 sr 50 Wed Jul 26 20:32:06 1989 average personal savings rate ---- Functions ---- add 2 ---- Macros ---- LS 0 SST5> CLEAR MACRO # Clear macros only SST6> LIST ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate dpi 50 Wed Jul 26 20:32:06 1989 real disposable income per capita pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 sr 50 Wed Jul 26 20:32:06 1989 average personal savings rate ---- Functions ---- add 2 SST7> CLEAR # Clear all SST objects SST8> LIST No objects in memory
CLS clears the screen on systems which support this action. On
some systems the TERM or SSTTERM environment variables
must be correctly initialized before this command may be used. For more
information see CONFIG.
SST1> cls # clear the terminal screen
This command does listwise deletion of each observation for which any of the variables in VAR have missing data, or which are excluded by the IF or OBS subops, and relocates the remaining data sequentially from the beginning of the file. See also EXPAND.
expression is
true.
observation
list.
TO subop must agree with
the number listed in the VAR subop.
Many of the operating parameters of SST can be changed by the user. To
change these characteristics use the CONFIG command. The basic
syntax is CONFIG option[parameter {= value2] where the parameter
and optional value depend on the option specified. If no command is
specified the current options are printed.
EDIT command must be used to enter the SST online
editor. To automatically invoke the editor for each input line specify
EDIT[on]. EDIT[off] turns the autoedit feature off (the
default). The term option can be used to change the terminal type
used by the editor. Specifying an unknown terminal type causes the
autoedit feature to be turned off. The block option determines
whether a block cursor is used in edit mode (on terminals which support
different cursor types). The default is block=on.
length sets the history list length to n. Setting
n to zero (or alternatively using the off option) turns the
history mechanism off. The batch option controls whether commands
read from batch files are stored in the history list. For more information
on the meta option, see section Changing SST's metacharacters
long option causes the MORE filter to display a longer, more
descriptive prompt as opposed to its normal terse prompt (selected with the
short prompt). The lines option sets the number of lines on
the screen (the lines= string can be omitted). If the number of
lines is set to zero or the off option is specified the MORE filter
is turned off. If the on option is given, SST will try to determine
the number of lines on the screen automatically.
OUT[on]
will turn the output back on.
PRECIS subop allows the user to specify the number of
significant digits used when printing output. The default precision is
five digits. New precisions may be set between one and eight digits
using the length option. The val option allows certain SST routines
to print value labels instead of numerical values for SST variables
which have an associated value list. For more informtion on value
labels, see LABEL.
auto option to on allows the LOAD
command to set the current range based on the size of the data in the
saveset. See the LOAD command for more details.
length option sets the number of commands for which output is
saved. Specifying a length of zero (or using the option off) turns
off the replay mechanism. The batch option controls whether the
output from commands executed in batch files are saved in the replay
buffer.
backup option forces the SAVE command to create backup
copies of files that are overwritten. The default is not to create
backup copies. The warn option causes the SAVE command to
print a warning message when backup copy of a file is created. The
checksum option controls whether checksums are verified when a
saveset is read into memory (default = on).
TERM. The SSTTERM
environment variable can also be used to set the graphics terminal type.
The text terminal type is used by the SST command line editor. By
default, the TERM environment variable is used to determine the
text terminal type. If an invalid terminal type is specifed, an error
message is printed and the autoedit option is automatically turned off
(see the EDIT subop, above).
TMP subop determines the pathname which SST uses when opening
temporary files. It defaults to the directory given in the TMP
environment variable or the current directory (if TMP does not
exist). A list of pathnames may be specified by seperating directory
names with a colon, : on Unix systems, or a semicolon, ;,
on MSDOS systems. Using a list of directories for the TMP subop
allows SST to use a different device for temporary files if the first
device fills up. This is particulary useful under MSDOS, where the
first TMP directory is typically on a RAM disk (for speed), with the
alternate directory on a hard disk (for volume). Currently only the
first two directories given in the list are recognized.
save option may be used to
control the generation of warning messages when the SAVE command
creates a backup file of an existing saveset
(see SAVE).
In its default state, SST will echo all commands as they are read from
a file, but it will not echo commands as they are executed within a
loop or macro. Echoing commands as they are read from a file is
controlled by the batch option of the ECHO subop. If we
specify `ECHO[batch=on]' then commands are echoed; `ECHO[batch=off]'
will cause commands to be read silently. For convenience, `batch=' can
be omitted.
If a file is run with the ECHO[off] option, the batch file is run
with echoing turned off. When the batch file exits the batch echo flag is
restored to its original value. Other options are available (see RUN).
Setting `ECHO[verbose=on]' will cause SST to echo each command just before it is executed. This means that you can see exactly what commands SST is executing. This is particularly useful when debugging command files. An equivalent form, `VERBOSE[on]' may also be used.
By default, SST does not print commands inside of loops, IF statements
and macros before they are executed. The ECHO[loop=on|off] and
ECHO[macro=on|off] subops can be used to control echoing inside
of loops (including IF statements) and macros respectively.
The primary SST prompt can be changed using the CONFIG PROMPT
command. The prompt can be changed to any string by specifying the
string as an argument to the PROMPT subop. There are several
special character sequences that are expanded within the prompt before
it is printed:
Sequence Expansion -------- --------- $h Current history number $s Blank space $t Current time $e Escape character (ASCII 27)
Additionally, variable references can be contained in the prompt string. These references are expanded each time the prompt is printed.
In order to prevent prompt and variable references from expanding when the command is executed (instead of when the propmt is printed), all metacharacters should be prefixed by the escape character (backslash). The following example demonstrates how to change the prompt string:
SST1> rem this is what the default prompt looks like SST2> config prompt[sst\$h>\$s] #Change the prompt sst3> rem this is what the new prompt looks like
Three of SST's metacharacters can be changed -- the HISTORY, MACRO and
ARRAY metacharacters. This might be useful if you use one of the
metacharacters for other purposes often (for example, $ on VMS
systems is often included in filenames) or you prefer a certain
metacharacter (UNIX csh users are probably used to ! as a history
character). To change the metacharacters use the CONFIG command
and the HISTORY, MACRO and/or ARRAY subops. The
arguments to each of the subops should be the the string meta=
followed by a backslash (\) and then followed by the desired
metacharacter. Below are some common mappings:
History Macro Array Comments ------- ----- ----- --------- % @ $ Default ! @ $ Use csh history metacharacter % $ $ Same macro and array metacharacter % @ @ Avoid problems with $ on VMS
The MACRO and ARRAY metacharacters can be identical. In this case the MACRO filter is applied first and the ARRAY filter is applied only if the MACRO filter could not find the listed macro. If neither the array or macro exist, an error message is printed. The HISTORY metacharacter should be unique.
Continue to the next iteration of a FOREACH, FOR or WHILE
loop. If more than one loop is in progress, the innermost loop is
terminated -- it is an error to issue the CONTINUE command outside of a
loop. For more information on SST loops see the respective topics.
SST1> FOREACH (i; 1 2 3 4 5) { # Simple loop to illustrate CONTINUE
1> IF ($i % 2 == 0) CONTINUE # Skip even numbers
1> ECHO Iteration number $i # Echo even numbers
1> }
Iteration number 1
Iteration number 3
Iteration number 5
SST2>
The COVA command computes descriptive statistics such as means,
standard deviation, ranges, and correlations on a set of one or more
variables. By default only univariate statistics are calculated. The
optional COV subop can be used to include a matrix of
correlations and covariances for the variables listed in the VAR
subop.
variable list.
COVA command considers an observation to be valid
only if it is valid for all variables listed in the VAR subop. If
the BYVAR subop is specified then the univariate statistics will be
computed independently -- missing observations in one variable will not be
considered missing in all other variables.
COV subop provides both correlations and covariances;
correlations are printed below the diagonal and variances and
covariances are printed above the diagonal.
COVMAT subop allows the (symmetric) covariance matrix of
the variables to be retrieved in matrix.
expression is true.
observation list.
cova var[*]
To obtain the mean of x when y equals one:
cova var[x] mean if[y==1]
The cvtsav program converts savesets created by SST version 1.8
and earlier to those used by SST versions 1.9 and up. To convert a
saveset, run the cvtsav program and pass as an argument the name
of the saveset to be converted:
cvtsav bkw
The old version of the saveset bkw will be saved in a file with the
same name and the extension .old.
cvtsav:
file instead of overwriting the input
file.
Input integer and string data from a formatted file. Column locations
of the variables are specified using the FMT subop. A period or
MD in a field is translated as missing data (except for string fields).
FMT[data list]
FMT[a 1-3 b 4] # Reads variable a from columns 1-3
and variable b from column 4
FMT[a 1-3 b 4-4] # Same
FMT[a b c 1-12] # Reads variables a, b, c from equal
length fields 1-4, 5-8, 9-12
FMT[a 1-2 (P) b 4] # Reads variable a in packed decimal
format, variable b in integer format
FMT[a 1-9 (S) b 4] # Reads a as a string containing
character data
FMT[a 1-2 (bn) b 3-5 (bz)] # Reads a treating blanks as missing
data, and reads b treating blanks
as zeros (the default)
FMT[/1 a 1-3 /2 b 2-5] # Reads a from columns 1-3 of record 1
and b from columns 2-5 of record 2
FMT[a 1-3 (MD=-99)] # Reads a with -99 translated to
missing data
FMT[a 1-3 (P,MD=-99) b 4] # Reads a in packed decimal, with -99
translated to missing data
FMT[a 1-3 (bn,MD=-98,-99)] # Reads a with blanks, -98, and -99
translated to missing data
input.dat, has the following data
123 456 789 012
The following commands are executed in SST
SST1> DATA FILE[input.dat] FMT[/1 x 2 /2 y 1-2] RECORDS[2]
SST2> print var[x y]
Obsno x y
1: 2.00000 45.00000
2: 8.00000 1.00000
The first observation is assigned the date specified in the START
subop. Dates are normally specified in the form `period : subperiod'.
The number of subperiods is specified in the PER subop and should be
a positive integer. If the PER subop is omitted, a periodicity of
one (i.e., annual data) is assumed. If no subperiod is specified for the
starting date in the START subop, the starting subperiod is assumed
to be the first subperiod of the starting period. If this command is run,
then the standard internal numbering of observations by sequential integers,
corresponding to the variable obsno, is replaced by the dating
syntax of this command. Thereafter, the dating syntax must be used in the
OBS subop. SST does not currently permit use of the date syntax in IF
subops, so that it cannot be used to select subperiods for analysis.
date start[1974:6] per[12] cova var[gnp] obs[1974:6-1988:5]
For quarterly data beginning in the first quarter of 1948, use:
date start[48:1] per[4]
Note that SST works correctly whether you number the years starting from 48 or 1948, so long as your usage is consistent. For annual data beginning in the year 1896, try:
date start[96:1] per[1]
The above command could be shortened to:
date start[96]
since the default value for PER is one.
Users can define their own functions using the DEFINE command.
The expression must be free of syntax errors but variables and other
functions that are referenced by the expression need not exist until it
is actually executed. When the defined function is called, the dummy
arguments (arg1, arg2, etc) will be replaced by the values of the
expressions used in their place in the function call.
A user function to standardize an expression by deviating it from its mean and then dividing by its standard deviation is given below:
SST1> DEFINE stand(x) = (x - mean(x)) / stddev(x) SST2> set ssr = stand(sr)
Deletes variables or other data elements currently in memory (or temporarily swapped to disk).
matrix list.
variable list.
SST1> LOAD FILE[bkw] SST2> DEFINE add(a,b) = a + b # Set up some SST objects SST3> MACRO ls LIST SST4> LIST ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate dpi 50 Wed Jul 26 20:32:06 1989 real disposable income per capita pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 sr 50 Wed Jul 26 20:32:06 1989 average personal savings rate ---- Functions ---- add 2 ---- Macros ---- ls 0 SST5> DEL VAR[dpi sr] MACRO[ls] # Delete some objects SST6> LIST ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 ---- Functions ---- add 2 SST7> DEL VAR[pop*] # Wildcards may be used in VAR SST8> LIST ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate ---- Functions ---- add 2 SST9>
The contents of the directory specified by path are displayed. If
path is omitted, the contents of the current directory are
displayed (see CD for more information).
SST1> DIR # Show contents of current directory
. <DIR> 7-16-89 11:51a
.. <DIR> 7-16-89 11:51a
SST.LOG 1212 7-30-89 4:55p
DATA <DIR> 7-27-89 9:52p
BKW.DAT 3300 7-26-89 8:23p
BKW.SAV 1539 7-26-89 8:32p
DEMO.CMD 796 7-26-89 8:23p
SST.CMD 219 7-27-89 10:47p
8 File(s) 317440 bytes free
SST2> DIR data # Show contents of subdirectory 'data'
. <DIR> 7-27-89 9:52p
.. <DIR> 7-27-89 9:52p
BLACKER.DAT 796 7-26-89 8:23p
DABNEY.DAT 199 7-26-89 8:43p
FLEMING.DAT 160 3-17-87 8:00a
LLOYD.DAT 33 7-04-89 6:51p
PAGE.DAT 5 7-26-89 9:45p
RICKETTS.DAT 126 7-26-89 9:45p
RUDDOCK.DAT 14 6-26-89 10:09p
9 File(s) 316416 bytes free
SST3>
DURAT estimates discrete hazard models by the method of maximum
likelihood using an iterative Newton-Raphson procedure. The dependent
variable, specified in the DEP subop, is the observed duration or
spell length for the observation. Spell lengths take only integral
values 1,...,T. The binary variable in CENSOR equals zero if the
observation is censored (i.e., if the end of the spell was not observed
before the termination of the sampling process) and equals one
otherwise. The escape probability for each period is assumed to be of
the form PHI(beta x_it) where PHI() denotes the standard
normal distribution function and x_it is the vector of independent
variables for the period specified in the IVALT subop. Each
variable list in the IVALT subop consists of T variable names --
observations on the variable described by the label for each of T
possible periods of, e.g., an unemployment spell. Values of the independent
variable for periods after the end of an unemployment spell are not
accessed, but should have non-missing values for proper sample
selection.
matrix name.
PRT subop for information on
printing the covariance matrix.
expression is true.
observation list.
n to 2. If n is 3, SST will also print the
parameter values at each iteration. To aid in debugging, SST will print
the numerical derivatives on the first iteration if n set at 5.
IVALT subop. By default all parameters start with a value of
zero.
spell denote the wave in which an individual was rehired. Some
workers are still unemployed at the end of the panel, so we code a variable
unemp3 which equals one if the worker is unemployed all three
periods and equals zero otherwise. There are two independent variables,
x and z, which are measured each period of the panel:
durat dep[spell] ivalt[x: x1 x2 x3 z: z1 z2 z3] censor[unemp3]
The echo command prints string on SST's output. If the
string ends with a colon (:) the trailing linefeed is suppressed.
Additionally the following C escape sequences are recognized:
\n print a newline \r print a carriage return \t print a tab
The ECHO command is most useful inside batch files to indicate
progress when echoing is turned off.
SST1> LOAD FILE[bkw] # Load data for use in this example
SST2> ECHO Entering loop
Entering loop
SST3> FOREACH (var; sr pop* dpi) { # Run commands on the variables
1> ECHO Working on variable $var # Show which variable we are at
1> REM Commands for execution go here # Execute some command
1> }
Working on variable sr
Working on variable pop15
Working on variable pop75
Working on variable dpi
SST4>
The command line editor, invoked by the edit command, allows you to
recall a command from the history list and edit it interactively. The
command is recalled from the history list in much the same way as the
history mechanism recalls commands. Unlike the syntax used for the
history mechanism, however, a space should separate the the word
EDIT and the history selector. Also, to recall the most recently
excecuted command command in the history list, we use the special
command edit last. Note that this is different from the history
mechanism, which uses %% to recall the last command. Once the
EDIT command has been entered, the selected command is displayed
for editing. The basic editor commands are:
^F or Right Arrow Move the cursor forward one character
^B or Left Arrow Move the cursor back one character
^N or Down Arrow Move the cursor down one line
^P or Up Arrow Move the cursor up one line
^A or Home Key Move the cursor to the beginning of the line
^E or End Key Move the cursor to the end of the line
^T or Insert Key Toggle between insert and overwrite mode
^J Insert a linefeed before the cursor
^O Insert a new line above the cursor
^D or Del Key Delete the character under the cursor
^H or Delete Delete the character before the cursor
^U Delete from the cursor to the start of the line
^W Delete the previous word (delimited by spaces)
^K Kill the rest of a line or delete the linefeed if
the cursor is at the end of the line
^L or ^R Redraw the edited command
Return Exit the editor and execute the command
^C or Cntl Break Quit the editor without executing the command
Initially the editor is in insert mode: printable, non-control characters are inserted before the cursor and the cursor is moved one position to the right. In overwrite mode typed characters replace the characters in the command.
The editor can be left on continuously by using CONFIG EDIT[ON].
In this case, all input to SST is through the editor.
The command editor key bindings can be changed to allow any function to be
bound to any key. When SST starts up it looks for the file sst.key or
.sstkey in the current and home directories. If the file exists, it is
read line by line and the editor binding table is updated accordingly. The
format for a single line is:
keyname function #comment
The three fields must be separated by white space but any of the fields can be omitted. The keyname field gives the key that is to be rebound. The keyname can be one of the following:
left right up down home end insert delete ESC
In addition the keys F1, F2, ..., F10 are also recognized and correspond to the numbered function keys on the keyboard, if any.
^X
and ESC by default. These may be changed by binding keys to the
Control-X-prefix and ESC-prefix functions.
The function field gives the action that should occur when the key is
pressed. If no function is present the key will not have any effect
when it is pressed. See section Editor functions. The comment field, preceded by a hash (#), may be used
to explain the function of the key in greater detail.
In the list of functions given below, the key sequence shown in parentheses gives the default key binding for each function.
backward-char (^B)
beginning-of-line (^A)
Control-X-prefix (^X)
ESC-prefix (ESC)
^X and
ESC by default). Once these keys have been defined, the keyname for
that key can be used as the prefix keyname in the sst.key initialization
file.
delete-char (^D)
delete-backward-char (delete, ^H)
delete-backward-word (ESC delete)
delete-beginning (^U)
delete-end
delete-line
describe-bindings
describe-key
end-of-line (^E)
execute (^M)
execute-check
execute-command
forward-char (^F)
help
insert-history
insert-tab (^I)
interrupt (^C)
kill-line (^K)
newline (^J)
next-line (^N)
nil
open-line (^O)
overwrite-mode (insert)
previous-line (^P)
print-history
redisplay (^L, ^R)
save-noexec
:p command in the SST history mechanism.
self-insert-char
set-key
shell-command
suspend (^Z)
previous-command
The ENTER command allows data to be entered or changed from the
keyboard in an interactive editing mode. The program will prompt the user
for data values on the variables specified in the TO subop in the
range specified by the OBS subop. When finished with data entry,
type `q' or `quit'.
expression is true.
observation list.
SST1> ENTER TO[year parts labor] OBS[1-3]
year(1) [ MD ]: parts(1) [ MD ]: labor(1) [ MD ]:
year(2) [ MD ]: parts(2) [ MD ]: labor(2) [ MD ]:
year(3) [ MD ]: parts(3) [ MD ]: labor(3) [ MD ]:
SST2> # Add and change the data
SST3> ENTER TO[year parts labor] OBS[2-5]
year(2) [ 1984.000000 ]: parts(2) [ 53.869999 ]: labor(2) [ 84.050003 ]:
year(3) [ 1985.000000 ]: parts(3) [ MD ]: labor(3) [ 29.250000 ]:
year(4) [ MD ]: parts(4) [ MD ]: labor(4) [ MD ]:
year(5) [ MD ]:
SST4> PRINT VAR[year parts labor]
Obsno year parts labor
1: 1.98300e+003 35.43000 73.92000
2: 1.98400e+003 MD 84.05000
3: 1.98500e+003 14.32000 29.25000
4: 1.98600e+003 9.50000 1.00020e+002
5: MD MD MD
Exit the current input file, returning control to the terminal.
The EXIT command terminates
the execution of commands from the command file regardless of whether it
occurs inside SST control loops.
Note that if EXIT is executed from the
keyboard rather than from a batch file, it has the same effect as QUIT:
it will exit SST completely. To exit SST completely from within a
command file, use the QUIT command.
Return-status is an optional integer that sets the value of the
status array (see ARRAY).
In order to avoid exiting from SST, this first example uses the SST batch file
exitdemo.cmd, the contents of which are as follows:
# exitdemo.cmd -- demonstrates the EXIT command
FOREACH (i; 1 2 3 4 5) {
ECHO Iteration number $i
IF ($i > 2) EXIT
}
ECHO Done with exitdemo # Note that this message will never be printed
To demonstrate both uses of the EXIT command, execute the following commands:
RUN exitdemo EXIT # note that this will take you out of SST, just like QUIT
Your output should look like this:
SST1> run exitdemo
# Exitdemo.cmd - demonstrate the EXIT command
FOREACH (i; 1 2 3 4 5) {
ECHO Iteration number $i
IF ($i > 2) EXIT
}
Iteration number 1
Iteration number 2
Iteration number 3
SST4> exit
D>
The observations on the variables in VAR are taken sequentially from the start, ignoring the global and local sample vectors, and are moved in sequence to the locations that are active, given the RANGE, and given the OBS or IF subops. This command can be used, for example, to move a block of new observations so they are positioned following current observations.
expression is true.
observation list.
VAR subop must agree with the number of variables listed
in the TO subop.
read to[x y] file[olddata] nobs[20] # read old data set read to[xn yn] file[newdata] nobs[10] # read new data set set d=obsno>20 expand var[xn yn] if[d] # relocate new following old set x = d?xn:x # merge data sets set y = d?yn:y
The FIGURE command allows you to combine a set of SST plots
into a single figure. SST executes the block of commands given in the
FIGURE command and superimposes all plotting output. By using
the SIZE subop for the plotting commands, multiple plots can be
combined into a single figure. If the TERM subop is used for
any of the plotting commands, it must be identical for all of the
plotting commands.
The FIGURE command does not take subops.
SST1> LOAD FILE[bkw]
SST2> FIGURE {
1> SCAT VAR[sr pop*] SIZE[0 0 1 0.5] # lower half
1> HIST VAR[sr pop*] SIZE[0 0.5 1 1] # upper half
1> }
The FOR command allows you to run a set of SST commands while
some condition holds. It is modeled after the for loops of the C
programming language. The body for the FOR loop can either be a single
command on the same line as the FOR keyword or a set of commands
enclosed in braces. Execution proceeds as follows: SST executes the
init-command; this command typically initializes values to be
used in the loop. Next the logical expression test-expr is
evaluated; if it is true, it performs the specified block of commands;
otherwise it proceeds to subsequent commands outside the body of the
loop. After the first pass through the set of commands, the
update-command is executed and test-expr is re-evaluated.
Again, if it is true it performs the commands. If the expression is
false, it proceeds to the commands following the loop.
The FOR command does not take any subops.
SST1> LOAD FILE[bkw]
SST2> FOR (CALC counter = 1; counter <= 50; CALC counter += 20) {
1> # Run the regression for a set of observations
1> COVA VAR[sr] IF[obsno < counter]
1> }
Warning: no valid observations
Variable: sr average personal savings rate
Mean 9.04350 Standard deviation 4.46338
Minimum 0.60000 Skewness -0.43968
Maximum 16.85000 Kurtosis 2.02817
Valid observations 20
Variable: sr average personal savings rate
Mean 10.04750 Standard deviation 4.51185
Minimum 0.60000 Skewness -0.28951
Maximum 21.10000 Kurtosis 2.73361
Valid observations 40
The FOREACH command allows you to execute a set of SST commands
for each name in a list. Whenever $name is encountered in the
block of commands given in the FOREACH loop, it is replaced with the
current value of the index variable, name. Any valid SST
identifier may be used as the index variable. The list of values that
the index variable is to take on should be separated by commas or
spaces.
SST wildcard characters are also allowed in the FOREACH value list. The index variable will be set to each variable name that matches the wildcard specification, just as if that variable name had actually been given in the FOREACH value list.
A range may be specified in order to run a FOREACH loop over all
integers from some starting value to some ending value. Instead of
typing in a list of values for list, we can type "{start-stop2"
where "start" and "stop" are both integers with start < stop. The
BREAK and CONTINUE commands may be used to alter the flow
of a FOREACH loop. For more information see BREAK
or see CONTINUE.
The FOREACH command does not take subops.
SST1> LOAD FILE[bkw]
SST2> FOREACH (var; sr pop*) { # Create a loop over a group of variables
1> ECHO Running loop on variable $var
1> REM Your command would go here
1> }
Running loop on variable sr
Running loop on variable pop15
Running loop on variable pop75
A oneway frequency distribution is computed for the variables specified in
the VAR subop. The resulting display shows the number of times each
distinct value in the variable is taken. The IF and OBS subop
control selection of the sample observations. There is no restriction of
the number of distinct values that the variables in the VAR subop
can take.
variable list.
expression is true.
observation list.
Transfer control to the statement following the label label-name.
A label is a line containing a label name followed by a colon
(`:'). It is used only to indicate a location for the GOTO
comand. The label name may be a string composed of letters, numbers or
the underscore (`_') and must start with a letter or an underscore.
There is one restriction on where labels can
occur -- a label should not
appear inside the body of a loop, an IF statement or a MACRO
definition.
The GOTO command is only valid inside a batch file and does not
use any subops.
This example uses a batch file, since GOTO cannot be used with keyboard
input. The contents of the batch file are as follows:
# Gotodemo.cmd -- demonstrates the GOTO command GOTO bottom REM The middle will be executed after the bottom middle: REM Middle of file -- we will exit now to avoid creating an infinite loop EXIT bottom: REM This is the bottom of the file GOTO middle
To run this example, execute the following command:
RUN gotodemo
The output should look like this:
SST1> RUN gotodemo GOTO bottom REM This is the bottom of the file GOTO middle REM Middle of file -- we will exit now to avoid creating an infinite loop EXIT SST8>
The HELP command is used to access the online SST reference
manual. This manual contains the same information as the printed SST
reference manual. To specify information on a particular topics use
the syntax:
help <topic>
You may exit the HELP utility by entering `q' when prompted for a subtopic.
While in interactive mode you can either enter a subtopic name or a one
character HELP command whenever SST asks you for a new topic. To get
a list of commands available enter `?' followed by RET. The
HELP commands are summarized below:
<subtopic> skip to the specfied subtopic\n\ * list available subtopics\n\ n, p move to the next, previous topic in the manual\n\ u move up from this topic\n\ g move to a node specified by name\n\ l move the the last node visited\n\ b go to the beginning of this node\n\ q quit the help command\n\ ? print a summary of commands\n\
The SST HELP file, sst.hlp, contains all the text for the online
version of the SST reference manual. If SST cannot find this file it
will print an error message and you will not be able to access the
manual. SST looks for the help file in several places:
A histogram of the variables specified in the VAR subop is
plotted using the observations determined by the IF and
OBS subops (if present). The range of the variables is divided
into equal intervals (called bins) and boxes with height proportional to the
number of observations in each bin are plotted. The bin spacing corresponds
to the subquanta spacing of the x axis (see PARM).
When more than one variable is plotted, a cumulative count is kept for each
bin and boxes are drawn for each subtotal as the variables are processed.
Boxes can be plotted side by side using the horizontal option of the
PARM subop and one in front of the other (smallest first) using the
vertical option. If the total option is present, the total count
for all variables is used to determine the height of the box for each bin
and only the outline of the boxes is displayed (this is the default mode
for one variable).
expression
is true.
TERM must also be present unless this
has been set as an environment variable on your system.
SIZE.
terminal. See TERM.
SST1> LOAD FILE[bkw] SST2> HIST VAR[pop15 pop75]
The HISTORY command takes an optional argument, n, which
specifies the number of commands to be printed. A sample history list
might look like this:
1 load file[bkw] 2 reg dep[sr] ind[pop15 pop75] 3 scat var[sr pop15 pop75] 4 list var[pop*] 5 history
Commands from the history list can recalled and executed using the SST history metacharacter -- the percent sign (`%'). Several formats are available for recalling a command. If we have just entered the commands listed above (making the current history number 6) we can recall commands as follows:
Selector type Example Command recalled ------------- ------- ---------------- Absolute %3 scat var[sr pop15 pop75] Relative %-4 reg dep[sr] ind[pop15 pop75] Command search %lo load file[bkw] Previous %% history
No space is allowed between the history metacharacter and the selector. SST will print the command after performing history substitution so that you can see the command that is executed.
Besides the selection commands given above, you can also select a range
of commands using history numbers. To re-execute the 5th through 7th
commands from the history list we use the command `%5-7'. History
ranges can also be used with the EDIT command to edit several
commands and rerun them.
The history mechanism supports 4 operators. An operator simply
takes a previous command from the history list and performs some
simple action on it. The syntax for specifying an operator is
`%selector:operator' where selector is one of the forms
mentioned above. The four operators and their functions are:
Op Example Description -- ------- ----------- p %5:p Print the command without executing it s %reg:s/old/new/ Substitute 'new' for 'old' in the cmd (once) gs %co:gs/old/new/ Globally substitute 'new' for 'old' e %-2:e Edit the command string
More than one operator can be applied by concatenating the operators after the selector. So we could say `%reg:gs/pop15/pop75/:e' to mean "recall the last command beginning with `reg' and globally replace `pop15' with `pop75' and then invoke the editor on the resulting command string". Notice that the history command `^old^new^' is equivalent to `%%:s/old/new/'.
For convenience, the history character is not expanded if it precedes a space, equals sign or open parenthesis. This allows the SST expression routines to be used without having to constantly retype the backslash character.
The body for the IF statement can either be a single
command on the same line as the IF keyword or a set of commands
enclosed in braces. The logical expression for the IF statement can be any valid CALC expression.
If it evaluates to exactly zero it is considered to be false, otherwise it
is true.
The ELSE statement is also supported. It allows you to provide an alternate
action if the logical expression of an IF statement is false. Following
the ELSE keyword by another IF statement allows simple case-type statements
to be set up:
if (abs(b1[3] < 1.0)) {
reg dep[y] ind[x1 x2]
2 else {
if (abs(b1[2] < 1.0)) {
reg dep[y] ind[x1 x3]
2 else {
reg dep[y] ind[x2 x3]
}
}
If you are going to use an ELSE statement you must enclose the IF-body
and the ELSE-body in braces and the ELSE statement must appear on the
same line as the closing brace of the IF-body.
The IF statement does not take any subops. The test expression in the
IF statement is a scalar; if vectors appear, only their first components
are used in testing the truth of the expression. If the test expression is true, then the block of SST commands is executed for all observations.
This is quite different than the IF subop in other statements, which
evaluates a logical expression observation-by-observation.
The IMPORT command allows user compiled functions to be
incorporated into SST in a limited manner. The IMPORT command is
currently only supported under SunOS 4.0 and above.
Imported functions can be used to evaluate scalar quantities in SST expressions. The functions can be used anyplace that scalar functions are normally allowed. Since the functions are compiled, they typically execute faster than a function written as a (uncompiled) SST expression. Also, the imported function mechanism allows individual customization of SST.
When executing an imported function, the normal SST error mechanisms are easily bypassed. It is the user's responsibility to insure that imported functions do not interfere with SST data structures or otherwise overwrite SST's internal variables. Improperly written user functions can cause SST to core dump or otherwise abort execution.
.o extension must be included.
IMPORT command. Understanding these error messages requires some
knowledge of unix linking terminology and methods.
FUNC subop
is not actually present in the object file.
This error can also occur if the symbol table has been stripped from
SST. For systems which allow the use of IMPORT, the symbol table
should be left in place when SST is installed.
FILE is not a valid object module.
The file should be compiled with the cc command and must have its
symbol table intact.
IMPORT must be able to locate the executable for SST in order to
access its symbol table. The executable is searched for in the current
path, specified by the PATH environment variable.
user.c are:
int myfunc(stack, argc)
double *stack;
int argc;
{
extern double atan2();
if (argc != 2) return 0;
stack[0] = atan2(stack[0], stack[1]);
return 1;
}
After compiling this function (cc -c user.c) we may do the
following:
SST1> IMPORT FILE[user.o] FUNC[myfunc]
SST2> calc atan(1) # SST version
0.78540
SST3> calc myfunc(1,1) # user version
0.78540
The variable or variables specified in the VAR subop will be
associated with the label supplied in the LAB subop. Variable
labels should not exceed more than thirty characters. The VAL subop
is used to associate value labels to particular values of a variable. Value
labels can be no more than eight characters and must not contain spaces.
Value labels are used in printing tables and frequency distributions. To
delete any already existing labels information associated with the
variables in the VAR subop, use the second form of the command given
above.
If the FILE subop is present, the LABEL command adds,
changes or deletes a saveset label. This label appears when the saveset
is listed with the LIST command. If the LAB subop is
present, the saveset label is overwritten (or created if it doesn't
exist). If the FILE subop is present and the LAB subop is
omitted, the label for the specified saveset is deleted.
FILE subop is
present, this subop is ignored.
LAB subop is recognized for matrices.
VAL subop.
sex which
takes the values one (for females) and zero (for males):
label var[sex] lab[female dummy] val[1 female 0 male]
LIST provides information about variables or other SST objects
either currently stored in memory or in an SST saveset. The default action
is to list information about all variables, matrices, functions and macros
stored in memory. This information includes the object name, size (i.e.
number of observations, dimensions or argument count), the time it was last
modified, and a short description (if available). By default, all
information about the objects is listed -- this can be overridden using the
NAMES subop. The FILE subop can be used to list saveset
information instead of objects in memory.
Specific objects stored in SST's memory can be listed by specifying the object name and an optional list of objects. The valid SST objects are listed below.
filename instead of memory. Besides
giving information about the variables in the saveset, the saveset
modification time and saveset label are also printed.
matrix-list. If no argument is
specified all matrices will be listed.
macro-list is included
only those macros will be listed.
FILE subop to specify that the saveset
is contained on a tapedrive instead of a disk. The effect of this option
is to minimize random access of the saveset. If the TAPE option is
specified only the long form of the listing is available (i.e. NAMES is
ignored).
SST1> LOAD FILE[bkw] # Load some objects into memory SST2> DEFINE add(a,b) = a + b SST3> MACRO ls LIST SST4> LIST # List all SST objects ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate dpi 50 Wed Jul 26 20:32:06 1989 real disposable income per capita pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 sr 50 Wed Jul 26 20:32:06 1989 average personal savings rate ---- Functions ---- add 2 ---- Macros ---- ls 0 SST5> LIST VAR # List just variables ---- Variables ---- deldpi 50 Wed Jul 26 20:32:06 1989 real disposable income growth rate dpi 50 Wed Jul 26 20:32:06 1989 real disposable income per capita pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 sr 50 Wed Jul 26 20:32:06 1989 average personal savings rate SST6> LIST VAR[pop*] MAT # List variables and matrices ---- Variables ---- pop15 50 Wed Jul 26 20:32:06 1989 percentage population under 15 pop75 50 Wed Jul 26 20:32:06 1989 percentage population over 75 No matrices stored in memory SST7> LIST NAMES # Short form ---- Variables ---- deldpi dpi pop15 pop75 sr ---- Functions ---- add ---- Macros ---- ls SST8>
The LOAD command is used to read SST data from an SST saveset
(created with the SAVE command). If no options are given, all
objects contained in the saveset will be loaded into memory. Otherwise,
only the indicated objects are loaded. Currently SST savesets support the
following objects types:
Object type Subop Description ----------- ----- ----------- variable VAR SST observation vectors (variables) matrix MAT matrix function FUNC User-defined functions (created with DEFINE) macro MACRO User-defined macro (created with MACRO)
Objects that already exist in memory will be overwritten.
By default, the length of the current observation range used by SST is
set to the length of the largest variable loaded from a saveset. This
action is not performed if the current observation range has been set
explicitly with the RANGE command. Additionally, the LOAD
command will never set the current range to a length less than that set
by a previous LOAD or ACCESS command. The auto range
feature can be enabled and disabled using the command CONFIG
RANGE[auto=on|off].
Versions of SST prior to 1.9 use a saveset format which is not compatible with the current savesets. A conversion program, `cvtsav', is available to convert between formats.
DIF nor the DBASE subops are included (see
below), SST assumes an extension of .sav.
FILE
subop, SST assumes an extension of .dbf.
FILE subop, SST
assumes an extension of .dif.
function-list is omitted, all
functions contained in the saveset will be loaded.
observation-list.
TAPE subop can be used in place of FILE to optimize
saveset access for sequential access devices. This subop also results in
some savings in memory usage at the expense of speed.
TO subop
must agree with the number listed in the VAR subop.
TO subop.
SST uses checksums in savesets to indicate when data has been corrupted
in a savesets. It is generally assumed that low level error detection
and correction is present on the raw media used to store savesets, so
only limited error checking is used. Checksum verification (during
reads) can be turned off using the CONFIG command. Checksums are
always generated during writing of savesets.
Checksums are present in savesets created by SST version 2.2 and
greater. All savesets can be read and written by any version of SST
(see Bugs below). The cvtsav command can be used to add
checksum information to older savesets.
LOAD FILE[bkw] # load all objects in bkw.sav
LOAD FILE[bkw] VAR MAT # load only matrices and variables
LOAD FILE[funcs] FUNC # load functions from funcs.sav
LOAD FILE[bkw] VAR[pop15] TO[abc] # load variable 'pop15' to 'abc'
LOAD FILE[big.1] VAR[a] FUNC[b] MAT # load variable 'a', function 'b'
# and all matrices from 'big.1'
# Load observations 1-10 of variables pop15 and pop75
LOAD FILE[bkw] VAR[pop15 pop75] obs[1-10]
The LOGIT command estimates binary and unordered logit models by the
method of maximum likelihood using an iterative Newton-Raphson procedure.
The choice variable is specified in the DEP subop. The choice
variable takes a finite number of values. In the case when the dependent
variable is dichotomous (taken the values of zero and one, say), the choice
probabilities are given by:
Independent variables are specified in the IND subop, as in the
REG command. When the dependent variable contains more than two
distinct values, a multinomial logit model is estimated. If 0 is the lowest
numbered alternative, and j is another value of the dependent variable, then
the choice probability for j is given by:
This corresponds to interacting the variables in IND with dummy
variables for each alternative other than the lowest numbered one.
SST does not currently permit estimation of ordered logit models.
DEP subop, a separate matrix should be
given for each.
PRT subop for information on
printing the covariance matrix.
expression is true.
observation list.
PROB
subop. If multiple logits are to be performed a list of variable names
should be given (one for each variable listed in the DEP subop). If
the dependent variable has two categories, then the predicted probability
is the estimated probability that the dependent variable takes its high
value. If the dependent variable has more than two categories, so that a
multinomial logit is performed, then the list must include a name for the
probability of each alternative other than the lowest value. In the
case of multiple multinomial logits, there must be a list of such variables
for each dependent variable in order.
n to two. If n is three, SST will also print the parameter
values at each iteration.
PARM
subop. By default all parameters start with a value of zero.
WEIGHT subop is used to produce a Weighted Exogenous Sample
Maximum Likelihood (WESML) estimate of the logit model. The variable list
must contain one variable for each alternative, in the same order as the
indexing of the dependent variable. If each alternative indexed j has
frequency q_j in the population and s_j in the sample, and these
differ due to sampling by alternative, then the weights q_j/s_j yield
consistent estimates.
The MATCH command matches data in a file organized differently
from data in RAM. The data is usually stored in an SST system file
(saveset) which is specified in the FILE subop. The variable
specified in the KEY subop is used to match observations in the
file with data previously loaded into SST. It is necessary to have
previously loaded or created the KEY variable during the SST
session and a variable with the same name should be contained in the
file. For each observation, SST looks at the value of the KEY
variable in RAM and then searches for an occurrence of that value of the
KEY variable in the file. Then SST reads the data for that
observation into RAM. Only variables specified in the VAR subop
are loaded from the file. If the VAR subop is omitted, all
variables are loaded from the file except for the variables listed in
the KEY subop. SST savesets can be created with the SAVE
command SAVE.
If the FILE subop is not present, SST will read variables from
memory instead of from a saveset. The operation of the MATCH
command is unchanged. See section Using memory matching, below.
FILE subop is
present, SST will perform the matching operation using variables
contained in memory.
BY subop must match the number listed in
the KEY command.
BYLAB subop is present, the variables listed
are matched by value label instead. The list of variables to this subop
is a subset of the variables mentioned in the KEY subop above.
RP subop
is specified, unmatched observations are marked as missing data.
The RP subop also determines how value labels are copied from the
input to output variables. By default, existing value labels in
the output are not overwritten but new labels are added to the
variable. If the RP subop is specified, any value labels which
exist in both the input and output variables are changed to use
the input variable labels.
TAPE subop can be used in place of FILE to optimize
saveset access for sequential access devices such as tape drives. This
subop also results in some savings in memory usage at the expense of
speed when used with random access devices.
TO subop
must agree with the number listed in the VAR subop.
KEY).
The names used to store the variables can be changed with the TO
subop.
The MATCH command can be used to reorganize data in memory by
omitting the FILE subop. In this case, the operation proceeds as
with a file, except that variables which already exist in memory are
used. It is important to remember that unless the RP subop is
specified, observations which fail to match the specified keys are
not set to missing data. This is consistent with matching a
variable from a file into an already existing variable in memory.
Matrices can be created by running an SST command (such as REG with
the COEF subop) or by entering them explicitly. An explicit
matrix is created by surrounding a list of elements by braces, {2
(this is a change from SST 1.1 which used angle brackets). Column
elements are separated by commas and the semicolon is used to indicate
the end of a row. For example, the command
MATRIX {1, 2, 3; 4, 5, 6; 7, 8, 92
will print
[ 1] [ 2] [ 3]
[ 1] 1.00000 2.00000 3.00000
[ 2] 4.00000 5.00000 6.00000
[ 3] 7.00000 8.00000 9.00000
This is the way that SST print matrices. As with the CALC
statement, if an assignment is not specified the result of an
expression is printed on the terminal.
SST supports the usual operations between matrices. Addition, subtraction
and multiplication of matrices are denoted by +, - and
*. The operations are performed whenever the matrices have the
proper dimensions. There are two matrix division symbols, \
and /. If A and B are matrices then A\B and
B/A correspond to left and right multiplication of B by the
inverse of A. In general A\B denotes the solution X
to the equation A*X = B and B/A denotes the solution to
X*A = B. Left division A\B is defined whenever B has
as many rows as A. If A is square, it is factored using
gaussian elimination. The factors are then used to solve the equations
A*X[:,j] = B[:,j] where B[:,j] denotes the jth column of
B. The result is a matrix X with the same dimensions as
B. If A is not square it is inverted in a least squares
sense (using pseudo inverses). Right division operates similarly.
It is also possible to obtain element by element multiplication and
division. If A and B have the same dimensions A .* B
denotes the matrix whose elements are simple products of the individual
elements of A and B. Multiplication and division of matrices
by a scalar also use the operator