Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: pooling again


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: pooling again
Date   Sat, 17 Aug 2013 15:39:09 +0100

This doesn't sound like a solution at all. -collapse- changes the data
in memory and you have to read the original data back in again.
-preserve- and -restore- before and after your -collapse- would ease
that but as you imply you still have to loop over all your
identifiers.

I guess it would be a lot simpler to do something along the lines
recommended in the FAQ cited earlier.

Nick
[email protected]


On 17 August 2013 15:12, Andrew Reed <[email protected]> wrote:
> I've solved my problem. It is merely
>
> collapse (max) event2 if id!=(some id number), by (date)
>
> event2 is a copy of my original event dummy variable that i wanted to create to be safe. When I run this code is leaves me with my date variable and a collapsed event2 variable for the specified id number.
>
> Is there a way to prevent everything from going away, that is all my mother variables so I can continue running this code instead of running it, saving the output, pasting it back into my data set, and repeating the process? A smoother process would be nice but anything in the name of econometrics!
>
> Drew
>
> Den 17/08/2013 kl. 15.48 skrev Nick Cox:
>
>> There is a -summarize- command (which can be abbreviated -sum-), a
>> -sum()- function and an -egen- function -sum()-, so it is not clear
>> which sandpit you're playing in.
>>
>> http://www.stata.com/support/faqs/data-management/creating-variables-recording-properties/
>>
>> is an attempt at a systematic survey. The easiest trick, which has a
>> "Yes, of course!" flavour if you miss it, is just
>>
>> sum of others = sum of all - this value
>>
>> and under -by:- that can still be about two commands.
>>
>> You don't seem to be doing quite that, as there is talk of several
>> variables too.
>>
>> If you don't get a better answer, you may need to show data and/or
>> code. Just words can be pretty difficult for others to grasp.
>>
>> Nick
>> [email protected]
>>
>>
>> On 17 August 2013 14:22, Andrew Reed <[email protected]> wrote:
>>> I have 79 unique entity identifiers that correspond to different banks and countries. I currently have an event dummy variable coded for each entity and would like to create a modified form of this. The form I would like is the sum all of the events for all of the entities outside of the one entity the variable is being formed for.
>>>
>>> An example. In creating this new variable for Sweden, I would include all of the events for countries that are not Sweden. Then going to the next entity, let's say SEB bank, I would include all of the events that are not SEB bank, thus Swedish events would be included in this variable for SEB Bank but not for Sweden itself. I hope that makes sense. But it would go on and on.
>>>
>>> I'm playing around with the sum command as well as playing with the numerical identifiers but if someone has a quick and obvious answer I would greatly appreciate this.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index