Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: data extraction by date


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: data extraction by date
Date   Tue, 2 Dec 2003 11:16:37 -0500

You seem to be new to Stata syntax -- you should try the help system first
rather than ask the list a basic question that is readily answerable from
help.   A one-time indulgence:

gen byte var2=day(var1)<11 & month(var1)==1

will create var2=1 if var1 is a date before Jan. 11 and zero otherwise

Michael Blasnik
michael.blasnik@verizon.net

----- Original Message ----- 
From: "Michael Carney" <carneymh@bc.edu>
To: <statalist@hsphsun2.harvard.edu>; <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, December 02, 2003 10:49 AM
Subject: st: data extraction by date


> I have a series of stock returns sorted by Stata's standard date form
(that is, when 0 = 1Jan 1960). Is it possible for me to create a data set
with 1 for all dates ranging from 1 jan to 10 jan (including all years) and
zero otherwise. I've tried
>
> .   gen var2 = var1 if doy(1/4), month(1)
>
> but it doesn't seem to work. Any help would be appreciated immensely!!!
>
> regards,
> Mike


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index