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


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <t.fulge@uni-bremen.de> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index