Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: replacing with mean


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: replacing with mean
Date   Thu, 2 Dec 2010 19:04:33 +0000

One of my posts earlier today gave an example of the use of -foreach- and a pointer to an article on it. 

Nick 
n.j.cox@durham.ac.uk 

Fabio Zona

Thanks a lot to both Dimitry and Nick.

Last issue:  I have read the FAQ. However, it is just for one variable: how should I implement the commands when I have 20 or more different  variables? I am facing difficulties in writing the lines!!

Da: "Nick Cox" <n.j.cox@durham.ac.uk>

This is an FAQ. 

FAQ     . . Creating variables recording prop. of the other members of a group
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        4/05    How do I create variables summarizing for each
                individual properties of the other members of a
                group?
                http://www.stata.com/support/faqs/data/members.html

Fabio Zona

my request for "replace missing" was related to a more complex procedure I am trying to define. I think I better describe the whole problem and ask you for a more general and maybe effective solution.

Here is the problem.

Say I have 200 industries. I have a list of companies, List"A", of say 5000 companies distributed among these industries. For each of these companies I have 20 variables. 

          Companies
Industry   List"A"    Var1   Var2  Var3   
A             1        
A             2
A             3
..            
B
..


I have a separate list, List"B" of 700 companies, that is a subsample of List"A". 

I need to associate to each company "i" of List"B" (my sample for regression) the median value of its industry EXCLUDING the focal company "i", and have to do this for all 20 variables!

It's extremely challenging. How would you deal with this?

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index