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: How to assign cumulated frequencies to observations


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: How to assign cumulated frequencies to observations
Date   Sun, 15 Jul 2012 21:46:47 +0100

See detailed suggestions in

SJ-7-3  pr0033  . . . . . . . . . . . . . .  Stata tip 51: Events in intervals
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q3/07   SJ 7(3):440--443                                 (no commands)
        tip for counting or summarizing irregularly spaced
        events in intervals

Nick

On Wed, Jul 11, 2012 at 5:25 PM, Timm Fulge <[email protected]> wrote:
> I have appended two datasets. One consists of survey data and the other one
> has information on stories published by a cable news channel. They have in
> common the variables DATE (expressed as, for instance 20080101) and,
> correspondingly, day (a numeric expression of DATE starting with 1 for
> January 1st). For the survey data, these variables denote the date of the
> interview. For the media data, they denote the date a given story was aired.
>
> What I would like to do is to assign each observation of the survey dataset
> the cumulated frequency of the media output of the 2 weeks prior to the
> interview date. For instance, if an interview was conducted on day 23, I
> would like to create a new variable stating how many stories were aired
> about a given issue (e.g. unemployment) on days 8 through 22.
>
> I have read around quiet a bit and I imagine the solution will have
> something to do with running loops, but unfortunately I am too much of a
> Stata novice to figure this out by myself. Any help is greatly appreciated!
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index