Getting Started with LIMDEP

LIMDEP is an extremely useful program developed to analyze cross sectional data. It has a great range of techniques from basic linear regression to nested logit, parametric duration, and Possion regression. The on-line manual and the hard copy manual provide the necessary syntax to run all of these procedures. This page is an effort to help the novice LIMDEP user develop basic command programs to read and begin to analyze his/her data. In this effort, the basic elements of every command file LIMDEP program will be highlighted. Again, it should be emphasized that this page should not take the place of the manual which provides much more in-depth information, but instead should be seen as a primer.

Data Styles

In LIMDEP, the program easily uses existing ASCII data sets. LIMDEP will not be able to directly read in Excel or Quattro spread sheet files. However, LIMDEP is able to read .WK1 files created in either program. LIMDEP also easily reads csv, space and tab-delimited files. Here I suggest using csv files, this data style clearly defines the data matrix eliminating potential problems with unequal length variables.

Reading In Data

LIMDEP syntax is founded on the following form:

VERB; specification; specification; ... ; specification $

The verb is a unique character string identifying the function. If the command requires additional information the necessary data are given in more fields separated by semicolons (;). Commands always end with a "$". The commands are not case-specific nor space-specific.

Variable names can not exceed 8 characters. Certain words can not used as names for variables, matrices, namelists, or procedures:

ONE--this is used as the constant term in models

B, VARB--this is used as matrices, to read in estimation from all models

N--is used as the current sample size

PI--is always the number 3.14159...

S, SY, YBAR, DEGFRDM, KREG,LMDA, LOGL, NREG, RHO, RSQRD, SSQRD, SUMSQDEV --are scalars retained after regressions are estimated

As this discussion focuses on batch mode, the general expectation is that the LIMDEP user will be writing the command file in an editor, either on VET (using editors such as vi, aXe, Pico, or Gneumacs), or on a micro and then ftp-ing the program to VET. Batch mode LIMDEP requires that the user start the command file with the term BATCH.

The base command for reading in a file is:


READ; File = full name of the ASCII data set including the path

; Nvar = number of variables

; Nobs = number of observations

; Names = names for the variables $

The names of the variables are implemented in the following manner:

names (X1=variable1, X2=variable2, X3=variable3 . . . . . .XN=variableN) $

An example of this syntax is:


read; file = /vet1/bolks/data/articlep.dat; nrec = 8620; nvar = 32;

names (x1 =year, x2 = nat, x3 = demsc, x4 = demok, x5 = autoc,

x6 = concen, x7 = inscost, x8 = mono, x9 = xconst, x10 = cent,

x11 = scope, x12=sopphost, x13 = status, x14=mid, x15 = threat,

x16 = sumally, x17 = mp, x18 = dumyear, x19=dumpow,

x20=dumreg, x21=intmp, x22=intins,x23=intdem, x24=intreg,

x25=intpow, x26=inthreat, x27=dumyear1, x28=dumyear2,

x29=dumyear3, x30=dumyear4, x31=sumallyl, x32=cinc) $

Worksheet files created in Lotus 123, Excel, or Quattro can be read in with the addition of a format specification. If the names are at the top of the columns of the data the command is:

Read; File=name; Format=WKS; Names $

Missing Data

The internal code for missing datum is -999. Upon reading the data, LIMDEP converts any missing data encountered to the numeric value -999. The program does detect blanks in exported spread sheet programs as missing as well as "." produced in other statistical packages such as SAS. It is important to emphasize that in running routines or procedures the program will employ the -999 as valid data. This can seriously affect results. Given this idiosyncracy, two commands can be employed to eliminate missing cases

REJECT will delete any observations with missing values for a particular variable. It is necessary to use this command with each variable separately. SKIP can also be employed in the current data sample. Here LIMDEP inspects only the variables in the model command and temporarily rejects observations for which any of the variables are missing. Note, models employing panel data should use the REJECT rather than the SKIP command as SKIP will automatically by pass groups of observations causing unbalancing to occur. This point is more thoroughly discussed in Chapters 6 and 7 of the manual.

Data Transformation and the Creation of Variables

Data can be transformed relatively easily in the program. For example logarithms, differences, or restrictions can be carried out without great difficulty. Transformations are done with the CREATE command.

CREATE; Variable name = expression $

For example, to transform a variable into its natural logarithm, the syntax would use the variable milexp and develop a new variable millag:

CREATE; millag=log(milexp) $

Furthermore, the CREATE command is employed for conditional transformations. This format is similar to that found in other statistical programs:

CREATE; If (logical expression) name = expression $

This can be exemplified by:

CREATE; if (Age > 21 + FTJob = 1) Adult=1; (else) Child = 1 $

Other commands include RECODE, to combine values or make continuous variables into discrete choices, and SORT, to arrange variables in ascending or descending order:

RECODE; Variable; Range of values = new value $

SORT; lhs = key variable[; RHS = variables to carry] $

Chapter 5 of the manual provides an extended disussion and list of these types of transformations.

Estimating Models

All model commands employ the same structure first listing the type of model to be run, the dependent variable, the independent variables and constant, and then other model specifications.

Model Command; lhs = dependent variable;

rhs= list of independent variable;

other parts of the model $

An example highlights this structure. In the following example, descriptive statistics are run for all variables using the command DSTAT and then Ordinary Least Squares with the command REGRESS:

DSTAT; rhs= X1, X2, X3 $

REGRESS; lhs= Y;

rhs= one,X1,X2, X3 $

This structure is the universal pattern to run any of the LIMDEP procedures. The manual highlights the particular specifications to be used in each type of type of model. The proceding information should enable a complete novice to begin to analyze data in the LIMDEP program. Two sample programs are provided which run relatively advanced statistical applications.

Sample Programs

The following LIMDEP programs provide examples of commonly used statistical techniques which are not easily employed in other stastical programs such as SAS or SPSS.


Statistical Consulting Lab Links


Mission of the Statistical Consulting Lab

Recent Projects

Vet and Unix Information

Statistical Software

Data Resources

SCL Tips

Requests for Help and Discussion

  • Software Related
  • Research Related

Fall Schedule for Lunch Seminars

Statistical Links

Home to the Statistical Consulting Lab Page