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: pasting into stata


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: pasting into stata
Date   Wed, 18 Sep 2013 14:24:46 +0200

It is hard to see exactly what you are trying to do. However, it
sounds to me like you want something like this:

bys id : egen sum = total(<something>)

In general the -by- prefix is very powerful for this type of problem.

-- Maarten


On Wed, Sep 18, 2013 at 1:36 PM, Drew Reed <[email protected]> wrote:
> Hi,
>
> I have to paste into Stata in a certain way and I'm hoping someone
> knows code that will make this easier for me. I am working with panel
> data and need to populate a 'sum' variable so that I can subtract a
> variable that contains entity specific information so that I can
> produce a spillover variable.
>
> I have basically collapsed my information by date so that I am given a
> sum of all events that have happened during the 2813 days being used
> for observations. There are 70 entities I would need to paste this
> information into and as of right now the only way I know how to do
> this is to go through my dataset manually, filtering by id, and then
> putting in the variable.
>
> Is there a faster way to paste as such? I had originally used a looped
> code to try to generate these variables and after a week of running
> this code it produced faulty measures. I'd rather just put in the time
> and get it right but I'd also like to know if there is a paste option
> where I can paste the same data for all id values.
>
> Thanks in advance.
>
> Sincerely,
>
> Drew
> *
> *   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/



-- 
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   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