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: output variables and labels to excel


From   Caroline Wilson <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: output variables and labels to excel
Date   Mon, 19 Aug 2013 21:47:06 +0000

-outsheet- worked perfectly, thanks David!

----------------------------------------
> Subject: RE: st: output variables and labels to excel
> Date: Mon, 19 Aug 2013 17:34:43 -0400
> From: [email protected]
> To: [email protected]
>
> Try -outsheet- in Stata 11.
>
> David
> --
> David Radwin
> Senior Research Associate
> Education Studies Division
> RTI International
> 2150 Shattuck Ave., Suite 800
> Berkeley, CA 94704
> Phone: 510-665-8274
>
> www.rti.org
>
>
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Nick Cox
>> Sent: Monday, August 19, 2013 1:39 PM
>> To: [email protected]
>> Subject: Re: st: output variables and labels to excel
>>
>> The Statalist FAQ explains that you are expected to be using the
>> latest version unless you declare otherwise. -export excel- was not in
>> Stata 11.
>>
>> Nick
>> [email protected]
>>
>>
>> On 19 August 2013 21:35, Caroline Wilson <[email protected]>
> wrote:
>>> Hmm, I get an error when I use export - perhaps because I am using
> Stata
>> 11?
>>>
>>> . export excel name varlab using varlabs
>>> unrecognized command: export
>>> r(199);
>>>
>>> If there isn't a way to use export in Stata 11 - David, would there
> be a
>> way to modify your code to also include value labels? For example,
>> something like:
>>>
>>> Variable name Variable label Value label
>>> gender Patient gender 1;"Female";0;"Male"
>>> Race Patient race 1; "White"; 2 "Black";
> 3
>> "Other"
>>> etc.
>>>
>>>
>>> Many thanks to everyone who replied for all the great tips!
>>> Caroline
>>>
>>> ----------------------------------------
>>>> Subject: RE: st: output variables and labels to excel
>>>> Date: Mon, 19 Aug 2013 15:06:32 -0400
>>>> From: [email protected]
>>>> To: [email protected]
>>>>
>>>> Agreed. Great tip! Thank you.
>>>>
>>>> David
>>>> --
>>>> David Radwin
>>>> Senior Research Associate
>>>> Education Studies Division
>>>> RTI International
>>>> 2150 Shattuck Ave., Suite 800
>>>> Berkeley, CA 94704
>>>> Phone: 510-665-8274
>>>>
>>>> www.rti.org
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: [email protected] [mailto:owner-
>>>>> [email protected]] On Behalf Of Nick Cox
>>>>> Sent: Monday, August 19, 2013 12:05 PM
>>>>> To: [email protected]
>>>>> Subject: Re: st: output variables and labels to excel
>>>>>
>>>>> Good point. Thanks,
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>>
>>>>> On 19 August 2013 19:58, Robert Picard <[email protected]> wrote:
>>>>>> nope, this is a relatively unknown feature of -describe-. The
>>>>>> -replace- option creates a dataset with the output of -describe-.
>>>>>>
>>>>>> On Mon, Aug 19, 2013 at 2:56 PM, Nick Cox <[email protected]>
>>>> wrote:
>>>>>>> But you must create -name- and -varlab- yourself first, right?
>>>>>>> Nick
>>>>>>> [email protected]
>>>>>>>
>>>>>>>
>>>>>>> On 19 August 2013 19:48, Robert Picard <[email protected]>
> wrote:
>>>>>>>> It can't get any easier than...
>>>>>>>>
>>>>>>>> sysuse auto, clear
>>>>>>>> describe, replace
>>>>>>>> export excel name varlab using varlabs
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Aug 19, 2013 at 2:04 PM, Nick Cox
> <[email protected]>
>>>>> wrote:
>>>>>>>>> You could do something like this assuming that you don't have
>>>> more
>>>>>>>>> variables than observations.
>>>>>>>>>
>>>>>>>>> gen varname = ""
>>>>>>>>> gen varlabel = ""
>>>>>>>>> local i = 1
>>>>>>>>> quietly foreach v of var * {
>>>>>>>>> replace varname = "`v'" in `i'
>>>>>>>>> replace varlabel = "`: var label `v''" in `i'
>>>>>>>>> local ++i
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> and then export those two variables. But Roger Newson's
>>>> -descsave-
>>>>> is
>>>>>>>>> much more versatile and elaborate. -search descsave- for
>>>> locations.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Nick
>>>>>>>>> [email protected]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 19 August 2013 18:39, Caroline Wilson
> <[email protected]>
>>>>> wrote:
>>>>>>>>>> Hi Stata,
>>>>>>>>>>
>>>>>>>>>> I'm trying to output the names of all variables in my Stata
>>>> dataset
>>>>> and their labels to an excel file. For example, I would like to
> end
>>>>> product to look like this:
>>>>>>>>>>
>>>>>>>>>> Variable name Variable label
>>>>>>>>>> gender Patient gender
>>>>>>>>>> DOB Date of birth
>>>>>>>>>> Race Patient race
>>>>>>>>>> etc.
>>>>>>>>>>
>>>>>>>>>> Is there an easy way to do this? I tried codebook but it gave
> me
>>>> a
>>>>> lot more information than I needed, and I also had formatting
> problems
>>>>> when copying and pasting the output into Excel.
>>>>>>>>>>
>>>>>>>>>> Many thanks in advance for any help!
>>>>>>>>>> Caroline
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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