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]

st: How to assign cumulated frequencies to observations


From   Timm Fulge <[email protected]>
To   [email protected]
Subject   st: How to assign cumulated frequencies to observations
Date   Wed, 11 Jul 2012 18:25:08 +0200

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