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]
AW: st: How can I transfer the variable labels to excel using the outsheet command?
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
AW: st: How can I transfer the variable labels to excel using the outsheet command?
Date
Thu, 27 May 2010 13:41:51 +0200
<>
" I don't know how you'd reverse that in Excel. You would have a column of
variable labels. I understand that Excel users like to have such stuff as a
row."
You can simply copy the column and then "Paste Special -> Transpose" to turn
it into a row.
But reversing in Excel is not the only problem. The question is would you be
able to recreate the data in Stata from the csv? I bet not. So -ssc d
descsave- is still a competitor for this task, I think.
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Donnerstag, 27. Mai 2010 13:28
An: [email protected]
Betreff: RE: st: How can I transfer the variable labels to excel using the
outsheet command?
This has never been my problem, but I can think of one work-around.
Assuming the number of observations is at least as great as the number of
variables, you could copy the variable labels into a string variable and
export that too.
unab vars : *
gen varlabel = ""
local i = 1
foreach v of local vars {
replace varlabel = `"`: var label `v''"' in `i'
local ++i
}
I don't know how you'd reverse that in Excel. You would have a column of
variable labels. I understand that Excel users like to have such stuff as a
row.
Nick
[email protected]
A Loumiotis
Yes what I'm actually doing is creating a csv file and i'm using excel
to open it.
But my problem with the variable labels still remain. My concern is
not with the value labels of a categorical variable (which I know how
to export to a csv file) but with the variable labels of the variable
names.
For example I have used:
label variable var01 "this is variable one"
to create the variable label "this is variable one" for variable var01.
What I want is to export to a csv file not only the variable names but
also the variable labels.
On Thu, May 27, 2010 at 1:39 PM, Neil Shephard <[email protected]> wrote:
> On Thu, May 27, 2010 at 10:27 AM, A Loumiotis
> <[email protected]> wrote:
>> Dear Statalist,
>>
>> When I use the outsheet command the variable names but not the
>> variable labels are transferred to excel.
>> Is there any way to also transfer the variable labels to excel?
>
> As per the Statalist FAQ, it would be useful if you provided the
> _exact_ command you are using.
>
>
> 1. -outsheet- does not have the capacity to write Excel files. I
> suspect you are writing to a CSV (Comma Separate Variables) file and
> on your OS (I'll hazard a guess at some M$-Windows variant) this file
> extension is associated with M$-Excel so that when double-clicked on
> it opens up in that program.
>
> 2. The -outsheet- command should be default write out variables that
> have labels applied to them using the labels themselves, unless you
> have explicitly specified the -nolabel- option (as explained in -man
> outsheet-).
>
> So, without knowing what you are doing I suspect you mistakenly using
> the -outsheet using filename.csv, comma nolabel- (or similar) syntax,
> and if you omit the -nolabel- option you should obtain what you are
> after.
>
> Neil
>
> --
> "... no scientific worker has a fixed level of significance at which
> from year to year, and in all circumstances, he rejects hypotheses; he
> rather gives his mind to each particular case in the light of his
> evidence and his ideas." - Sir Ronald A. Fisher (1956)
>
> Email - [email protected]
> Website - http://slack.ser.man.ac.uk/
> Photos - http://www.flickr.com/photos/slackline/
> *
> * 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/
*
* 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/