Transpose of string variable dataset
sxpose, clear [force format(format) firstnames destring]
sxpose transposes a dataset of string variables, so that observations become variables, and vice versa. It is a rough and ready utility: use circumspectly.
sxpose is destructive. Your existing dataset will disappear. The compulsory clear option is intended to remind you of that.
The number of variables allowed in Stata is very much less than the number of observations allowed. See help on limits. In addition, with even moderate numbers of observations, you may run into memory problems when trying to transpose a dataset. See help on memory.
clear is a required option, flagging that you are aware that the current dataset will be cleared from memory.
force specifies that the transpose should go ahead even though the dataset contains numeric variables. Numeric values will be coerced to string using the format %12.0g or whatever numeric format is specified by the format() option. You may lose some precision, especially in non-integer values, when you do this.
format() specifies a numeric format to use in coercing numeric values to string. See above.
firstnames specifies that the first variable (first column) in the existing dataset is to be treated as a set of variable names for the variables in the transposed dataset. This first column will not appear as the first observation in the new dataset. Any values that are not legal variable names will be lost.
destring specifies that destring, replace will be run on the new dataset in an attempt to convert variables that are unambiguously numeric in content to numeric. No force will be applied. See help on destring.
. sxpose, clear
John Wallace suggested this problem.
Online: help for xpose