Transpose data

Transposing data will only be necessary in very few circumstances. This subchapter might therefore not be of interest to everyone. Most likely, what you are looking for is reshape (next tab).

transpose

Transpose data

*************
*** xpose ***


/*
"xpose" switchs rows and columns - i.e., it switchs observations and variables
*/


sysuse census, clear
xpose, varname clear	// need to specify "clear", as data in working space is replaced
br
// Now, variables are rows, observations are columns
// String variables are lost

xpose, clear
// String variables remain lost