Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: too long string-variable to get proper output


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: too long string-variable to get proper output
Date   Thu, 11 Jan 2007 18:11:34 +0100

On Thursday 11 January 2007 16:50, [email protected] wrote:
> I tried to generate a cross-table by using a stringvariable as
> rowvariable (names of spanish political parties) with up to 50 signs
> (%50s), and the years of the elections of spanish congress as
> columnvariable (%4.0g). I always got the %50s-variable truncated to 20
> signs in the output, so I couldn't transfer the table properly to an
> excel-sheet and finally had to use SPSS to manage it. is there a
> possibility to enlarge the first column for getting the whole 50 signs
> in?

Don't know why you want to transfer it to Excel. I would recomment  to
transfer data from Excel to stata to be able to produce high quality graphs,
publication ready tables, etc.

However, leaving that aside, you can always produce the table as resultsset
and tranfer this resultsset to Excel. Here is a very basic example, starting
from first principles.    I asume that the variable names are "partnames"
and "electyear", respectively.

  keep partnames electyear
  by partnames electyear, sort: gen n = _N
  by partnames electyear: keep if _n==1
  reshape wide n, i(partname) j(electyear)
  outsheet partname n*  using xyz.tsv, replace

Afterwards you can load the file xyz.tsv into excel.

Certainly you will have to play with this example to get what you want. The
story behind all this is that producint table is a matter of data management.
A table has rows and columns, just like a data set.

There is also a bundle of programs for creating and managing resultssets
written by Roger Newson. -findit resutssets- will guide you in the right
direction.

Many regards
Uli

-- 
[email protected]
030 25491-361
*
*   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