Sample comments on new users' posts YoY pre/post Welcome Wagon

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

--hack-r.com
--linkedin.com/in/datasci

--using 8/7/2018 - present as treatment group date
--based on https://stackoverflow.blog/2018/08/07/get-to-know-our-new-code-of-conduct/

--data doesn't refresh immediately in SEDE (I think) so I let "present" = 1 week ago
  

----------------------------
-- Select Treatment Group --
----------------------------

select Min(Id) as PostId
  into #tmp0
from Posts a
  where PostTypeId = 1
  and CAST(a.CreationDate AS DATE) between '08/07/2018' and '08/19/2018'
  group by OwnerUserId;

select a.* 
  into #treatment
from comments a 
  join #tmp0 b 
  on a.PostId = b.PostId;


----------------------------
-- Select Control Group   --
----------------------------

select Min(Id) as PostId
  into #tmp00
from Posts a
  where PostTypeId = 1
  -- YoY sample
  -- shifted 1 day to account for day of the week
  and CAST(a.CreationDate AS DATE) between '08/08/2017' and '08/20/2017'
  group by OwnerUserId;

select a.* 
  into #control
from comments a 
  join #tmp00 b 
  on a.PostId = b.PostId;
   
select top 5 * from #control;

-------------
-- Combine --
-------------


select *, 0 as flag_treatment 
  into #sample
from #control;

insert into #sample
  select *, 1 as flag_treatment 
  from #treatment;

select * from #sample;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results