I need to transpose a dataset that contains string variables. In Stata 7, I could -set type
strX- just prior to -xpose- and it would retain the string variables. (-xpose- sets string
variables to missing numerical variables in both Releases 7 and 8.) In Stata 8, -set
type- no longer allows setting the default data type to string, so I use -version 7: set
type strX- as in the illustration do-file below. Is anyone aware of a more graceful
approach to this?
Joseph Coveney
-----------------------begin illustration.do---------------------------
clear
set obs 10
set seed 20030126
forvalues i = 1/5 {
generate v`i'=char(round(uniform()*255 , 1))
}
compress
quietly aformat _all
preserve
xpose, clear varname
list, noobs clean
restore
capture noisily set type str5 /* no longer allowed */
version 7: set type str5
xpose, clear varname
list, noobs clean
exit
-------------------------end illustration.do----------------------------
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/