Announcement

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

  • group data

    Hello,
    I need a help to group my data as next:
    I am working on a cross-sectional data over the period (2011-2015) using around 21 variables (I am testing a variable called csr before and after new regulations launched in 2014) and I need to split my sample for two groups using benchmark year (2014), on other words, I want to run t test to compare the first sample (group of the years 2011and 2012) with the second sample (group of the years 2014 and 2015).
    I know that I need to run the paired ttest but to do that I have to split the sample firstly to be pre and post the new regulations depending on the year.
    I run the following code to split the sample :

    "gen post = csr if inrange (year,2014,2015)"
    "gen pre = csr if inrange (year,2011,2012)"

    but when I tried to run the paired ttest using the following code it says that no observations:
    "ttest pre==post"

    I am stuck in this point and I need a professional advise please

  • #2
    Welcome to Statalist.

    You have accidentally posted your topic in Statalist's Mata Forum, which is used for discussions of Stata's Mata language. Your question will see a much larger audience if you post it in Statalist's General Forum.

    Also, if you have not already done so, take a look at the Statalist FAQ linked to at the top of this page for posting guidelines and suggestions.

    Comment

    Working...
    X