Statalist


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

-merge- (?) problem (was: st: MIME-Version: 1.0)


From   "Eva Poen" <eva.poen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   -merge- (?) problem (was: st: MIME-Version: 1.0)
Date   Mon, 29 Sep 2008 12:08:45 +0100

Ashim,

I'm sorry but I don't get it. You have two variables in your first
file, called symbol and ticker. What are they? Numeric, string? In
your second file you have symbol again (what about ticker?), and many
more variables, and you also have more observations (symbol does no
longer uniquely identify observations).

Now you want to do some operation that looks suspciously like a
-merge-, but it's unclear to me. For each symbol from file 1, you want
to -use- file 2 and -keep- all observations with this symbol.
Following what you said earlier, you will now be left with approx. 100
observations and many variables. Now you say you want to save this "as
ticker in the 1st file". What do you mean by that? You want to save
all 100 observations and many variables, in the first file? And what's
that to do with ticker? Ticker already exists in the first file. Do
you want to replace it, and with what information? Or do you want to
add ticker to the second file?

You'll have to be more precise for someone to be able to help.

Eva

2008/9/29 Ashim Kapoor <ashimkapoor@gmail.com>:
> Hello everyone,
>
> I have 2 files.
>
> The 1st file has 2 columns --> symbol and ticker. [ each symbol is
> only in one observation ]
>
> The 2nd file has many more columns --> symbol and many other vars. [
> each symbol is in around 100 observations here ]
>
> I want to say foreach symbol in 1st file  {
>
> use 2nd file
>
> keep if symbol ==above symbol
>
> save as ticker in the 1st file
>
> }
>
>
> Can someone tell me how to do this ?
>
> I guess to start with I would have to save the entire observations in
> symbol var in 1st file in ONE local macro and similarly for the
> ticker. Can someone tell me how to do this ?
>
> Thank you,
>
> Ashim.
*
*   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   |   What's new   |   Site index