Generate string variable describing panel patterns
Syntax
xtpatternvar [if] [in] , generate(newvar)
Description
xtpatternvar generates a string variable holding information on panel patterns in a style similar to the output of xtdescribe. The pattern is a character string, "1" for every time unit that is present in the panel in which each observation is included and "." for every time unit that is not present in that panel. Note that the symbol "." has here nothing to do with missing values.
Remarks
A panel variable and a time variable must have been previously specified; use xtset.
xtpatternvar will not perform if the maximum length of panel exceeds 244, as then the resulting pattern can not be held in a Stata string variable.
The resulting string variable could impose substantial storage requirements in a large dataset.
Options
generate() specifies the name of a new variable to be generated. This is a required option.
Examples
. webuse abdata . xtset . xtpatternvar, gen(pattern) . tab pattern . whatever if strpos(pattern, "11111111")
Author
Nicholas J. Cox, Durham University n.j.cox@durham.ac.uk
Acknowledgments
This program grew from a Statalist question by Abdul Berâ. Stephen Jenkins provided encouragement.
Also see
Manual: [XT] xtdescribe