Announcement

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

  • How to merge biannual variable into annual one

    Hello,

    I'm currently working with two datasets. My problem is that the variable I need from one of them is measured biannually and coded with string variables measuring requests send to a firm (requests) by a country (country) based on a date (date).
    So I have encoded the (requests) variable and the (country) variable but I can't find a working format for the (date) variable, which is coded either like this: 2013-12-31 or this 2013-06-30, so either in December or June.
    For my calculation I have to combine the values of the semi-annual (requests) for each (country) into a single observation.

    I thought maybe with dummy variables but I haven't found a way.

    Thanks in advance for your time.
    Last edited by Heinrich Litowsky; 25 Jun 2020, 14:39.

  • #2
    You will increase your chances of useful answer by following the FAQ on asking questions – provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    Whenever you have dates, the first thing is to make sure they are read as dates in Stata. The user manual and other documentation on dates and times will help you. There a bit tricky but once you've got them in is a date it's easy to pull out the month or whatever.

    Once you've got that set up and have a year variable, then you can collapse the data by year and country if you want to (see collapse in documentation). Naturally, this only works for numeric variables – it's not clear what the mean or total of the string variable would mean.

    Comment

    Working...
    X