Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converting annual data into quarterly data

    Hello,

    I am having trouble with creating quarterly data for my annual data. I have three datasets, two annual and one quarterly. I am trying to convert the annual into quarterly and merge them with the quarterly dataset. Any advice will be appreciated. Thank you.
    year geofip county population
    ------------------------------------------------------------------------|
    3731. | 2016 "20197" Wabaunsee, KS 4 6876 |
    3732. | 2016 "20199" Wallace, KS 4 1499 |
    3733. | 2016 "20201" Washington, KS 4 5561 |
    3734. | 2016 "20203" Wichita, KS 4 2133 |
    3735. | 2016 "20205" Wilson, KS 4 8709 |
    |------------------------------------------------------------------------|
    3736. | 2016 "20207" Woodson, KS 4 3184 |
    3737. | 2016 "20209" Wyandotte, KS 4 164924 |
    3738. | 2016 "08001" Adams, CO* 7 497735 |
    3739. | 2016 "08003" Alamosa, CO 7 16047 |
    3740. | 2016 "08005" Arapahoe, CO 7 639605 |
    |------------------------------------------------------------------------|
    3741. | 2016 "08007" Archuleta, CO 7 12834 |
    3742. | 2016 "08009" Baca, CO 7 3534 |
    3743. | 2016 "08011" Bent, CO 7 5832 |
    3744. | 2016 "08013" Boulder, CO* 7 321761 |
    3745. | 2016 "08014" Broomfield, CO* 7 66596 |
    |------------------------------------------------------------------------|

  • #2
    Greetings An! If your goal is simply to provide a linear interpolation of each county's population from one year to the next, you'll first need to know when the data was collected, to assign the existing data points to that exact quarter. Let's say you know the data was collected during the first quarter of 2016. Here's a series of commands that creates a quarterly variable:
    Code:
    use AnsDataset.dta
    gen quart=""
    replace quart="2016q1"
    split quart, parse("q")
    destring quart1 quart2, replace
    gen timevar=yq(quart1,quart2)
    save populationdata2016q1.dta, replace
    If you apply the program also for the remainder of the data you have, you'll be able to fill in the blanks in population using 'generate', 'merge', 'tsfill', and 'ipolate'. This post might provide some guidance on that.

    Comment

    Working...
    X