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
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
Comment