Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -set type strX- in Release 8


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   st: -set type strX- in Release 8
Date   Sun, 26 Jan 2003 20:44:28 +0900

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index