Thank you Martin for your explanation.
Previous versions of Stata did automatically sense a long name and truncated it at 32 characters, however it held the long variable name in the variable label field. This long variable label was useful for some commands (eg -tab var1-. Previous versions did not prevent pasting of long variable names into the data editor. I regarded the copying/pasting of data from Excel to the Data Editor as a very useful feature of Stata, but now that seems to be prevented in Stata 11 when you have long variable names.
Cheers, Garry
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Monday, 17 August 2009 5:25 PM
To: [email protected]
Subject: st: AW: Paste Clipboard Data and long variable names
<>
The point is that Stata variable names must not have more than 32 characters, period, as seen in -help varname-. So when Stata senses an illegal -varname-, it automatically assumes that you cannot possibly want this to be a Stata -varname- and regards it as data. If it did not do this automatically, there would have to be additional dialogs to resolve the conflict with regard to the length of the -varname- which would probably add to your confusion...
You can observe the same arguments in the entry for -xmluse- and its
-firstrow- option...
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Garry Anderson
Gesendet: Montag, 17. August 2009 03:35
An: [email protected]
Betreff: st: Paste Clipboard Data and long variable names
Dear Statalist,
I am copying/pasting data from Excel into the Data Editor in Windows.
The first row has variable names. Stata 11 pops up a window labelled Paste Clipboard Data and asks Is the first row data or variable names?
The first row on the clipboard contains values that can be used as valid variable names
* Treat first row as data
* Treat first row as variable names
I select the second option and variable names are created. This popup only appears if all variable names have less than 34 characters. If any variable name has more than 33 characters Stata pastes the variable names and data into the Data Editor without showing the popup, however it regards the first row that contains the variable names as data and creates variables called var1, var2, var3, etc.
Previous versions of Stata did not ask any questions and always created variable names when they appeared as the first row, regardless of the number of characters in their name length. It appears that in Stata 11 one cannot have variable names that are longer than 33 characters and have Stata create these variable names when copying/pasting data.
For example, first row of variable names and data
This is the first row that contains variable names column2 column3
1 2 3
4 5 6
7 8 9
This creates four rows of string data, with the variables named var1,
var2 and var3.
Is there a method to prevent this popup and to always use the variable names in row 1?
I am using Excel 2003, SP3 and Windows XP SP3.
Cheers, Garry
*
* 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/