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

RE: st: collapse prob

From   "Nick Cox" <>
To   <>
Subject   RE: st: collapse prob
Date   Wed, 21 May 2008 12:17:44 +0100

I agree with Svend, but Martin's is a understandable wish. 

This is a trickier problem that might first appear. For example,
variable names might be too long to allow a simple prefix or suffix.
Whatever way of shortening the name is used, there is still a need to
maintain distinct names. This kind of problem arises with other
commands, such as -xi-, but producing good defaults could easily add a
lot of code to -collapse-. 

Rightly or wrongly, Stata makes this your problem. 


Martin Weiss

True, but I would want Stata to take care of the naming automatically.
prepend or append the name of the stat being calculated so that "(mean)
becomes "mean_gpa" in the output...

Svend Juul

Martin Weiss wrote:

In this example, does your Stata complain about a "name conflict" as

webuse college, clear
collapse (mean) gpa (median) gpa [fw=number], by(year)

In effect, you cannot calculate two statistics for the same variable
renaming one of the results. This is mentioned in [D] collapse at the
of page 48, but rather cursorily. And correct me if I am wrong, but
there is
just no way you could have these statistics renamed in the dialog box.
must first find out that you have the problem I am describing, and
edit the command line to 

webuse college, clear
collapse (mean) meangpa=gpa (median) mediangpa=gpa [fw=number], by(year)

to make this work. It took me quite some time to find that out...


In the dialog box you can type in the variable field:


Logically, I think it is obvious that two different pieces of
information must have different names.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index