Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: remove weekend data


From   "Sarah Edgington" <sedging@ucla.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: remove weekend data
Date   Thu, 31 May 2012 11:33:06 -0700

Tashi,
Unless there's something about your task that I'm not understanding that
solution looks like it should work fine.  Is there something about it that
you're unhappy with?  
If you don't want to keep the dow variable for any other purpose a shorter
solution is: drop if dow(date)==0 | dow(date)==6
I suspect that there isn't a specific command for distinguishing weekends
and weekdays because the dow function makes identifying them a one line
task.

-Sarah



-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of tashi lama
Sent: Thursday, May 31, 2012 11:13 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: remove weekend data


Hello all, 

There don't seem to have stata command or module to get rid of weekend data
although I think I have just enough way to do it using some technique. I
would like to present my solution in hope that I would get some feedback 

and other solutions. Say my dataset looks like

 

  date

03jan2012

04jan2012

05jan2012

06jan2012

07jan2012

08jan2012

 

gen dow=dow(date)

drop if dow==0  => to drop  sunday 

drop if dow==6  => to drop saturday 

 

Thanx... 

Tashi

  		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index