Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: AW: create a dataset or vector of variable names


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: create a dataset or vector of variable names
Date   Thu, 25 Feb 2010 19:19:16 +0100

<>

I probably misunderstand your intentions completely, but if all you want is
a new, empty dataset with the same variables as some other dataset, you can
simply gut the latter and -save- it under a new name:


*******
sysuse nlsw88, clear
drop in 1/l
save mynewfile, replace emptyok

use mynewfile, clear
*******


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sheena Sullivan
Sent: Donnerstag, 25. Februar 2010 18:41
To: [email protected]
Subject: Re: st: AW: create a dataset or vector of variable names

Thanks very much for that.  To sum, I did the following 


use mydata, clear
ssc inst descsave
descsave, sa(varname)  keep(name)
use varname
li

forval i = 1/109 { 			
	local names `names' `=name[`i']' 
}
matrix colnames R = `names' 
clear
svmat mymat, names( col )


which gave me a dataset from my matrix with the appropriate variables names.
Thanks again,
Sheena 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index