Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long date double(MktRF SMB HML RMW CMA RF) 19630701 -.67 0 -.32 -.01 .15 .012 19630702 .79 -.27 .27 -.07 -.19 .012 19630703 .63 -.17 -.09 .17 -.33 .012 19630705 .4 .08 -.28 .08 -.33 .012 19630708 -.63 .04 -.18 -.29 .13 .012 19630709 .45 0 .1 .14 -.04 .012 19630710 -.18 .21 .01 .06 -.07 .012 19630711 -.16 .14 -.3 -.06 .05 .012 19630712 -.12 .02 -.11 .12 .04 .012 19630715 -.62 .07 -.03 .17 -.06 .012 19630716 -.07 -.08 .14 -.06 -.07 .012 19630717 -.33 -.07 .15 .04 .1 .012 19630718 -.54 .27 .05 -.03 .32 .012 19630719 -.23 -.06 -.05 .16 -.31 .012 19630722 -.7 -.1 -.31 -.01 -.1 .012 19630723 .01 -.1 -.2 .04 -.08 .012 19630724 .46 -.1 -.01 -.11 -.31 .012 19630725 -.04 .14 .26 -.16 .18 .012 19630726 .35 -.14 .07 .04 -.08 .012 19630729 .11 -.17 .26 .07 -.11 .012 19630730 .84 -.29 -.27 .53 -.4 .012 19630731 -.13 .11 -.01 -.15 .34 .012 19630801 -.08 -.12 -.12 .17 -.02 .011 19630802 .29 -.14 .15 -.05 .02 .011 19630805 .57 -.42 .16 .03 .11 .011 19630806 .6 -.34 .25 .01 -.03 .011 19630807 -.19 .04 .17 -.19 .14 .011 19630808 .14 -.01 -.25 .29 -.33 .011 19630809 .6 -.09 -.06 .22 -.17 .011 19630812 .24 .2 .41 -.13 .32 .011 19630813 .27 -.26 -.03 .05 -.04 .011 19630814 .3 -.08 .21 -.19 .05 .011 19630815 .43 -.29 .37 -.19 0 .011 19630816 .15 .07 .1 .04 -.18 .011 19630819 -.05 -.01 -.1 -.06 -.06 .011 19630820 -.05 .02 -.25 .02 .09 .011 19630821 -.11 .34 -.12 -.07 .09 .011 19630822 .39 .07 .09 -.09 -.31 .011 19630823 .34 0 .1 .06 -.03 .011 19630826 .18 -.12 .14 .11 -.2 .011 19630827 -.44 .1 -.05 -.01 .14 .011 19630828 .77 .08 .44 .12 .21 .011 19630829 .18 .11 .02 .1 .11 .011 19630830 .44 .11 -.09 .13 -.29 .011 19630903 .23 .07 .06 .02 .2 .014 19630904 -.01 .06 -.06 -.39 -.05 .014 19630905 .47 -.1 .11 -.09 .03 .014 19630906 -.27 -.17 -.01 .13 -.04 .014 19630909 -.36 -.25 -.01 .05 .13 .014 19630910 .52 -.17 .42 .06 -.24 .014 19630911 .24 -.2 .2 -.07 .32 .014 19630912 -.09 .11 -.11 -.2 -.13 .014 19630913 .02 .35 -.15 -.31 .12 .014 19630916 -.16 .15 .19 -.08 -.38 .014 19630917 .03 -.2 .17 .05 .08 .014 19630918 -.43 .12 -.24 -.15 -.06 .014 19630919 .52 -.39 .17 .15 -.02 .014 19630920 .04 -.07 -.01 .09 -.34 .014 19630923 -.5 -.09 -.21 .09 .15 .014 19630924 .35 -.33 .12 -.07 .07 .014 19630925 -.58 -.25 -.08 -.41 .15 .014 19630926 -.81 .47 -.35 -.06 .29 .014 19630927 -.18 .28 -.22 .2 -.07 .014 19630930 -.6 .2 .08 .21 -.06 .014 19631001 .65 -.21 .25 -.05 -.13 .013 19631002 .1 -.13 0 .02 -.12 .013 19631003 .67 -.29 .85 -.35 .17 .013 19631004 0 .03 .06 0 .16 .013 19631007 -.23 .18 -.02 -.19 -.03 .013 19631008 -.14 .19 .25 -.03 -.21 .013 19631009 -.61 .15 -.05 -.01 .2 .013 19631010 .08 -.03 .15 .07 -.09 .013 19631011 .13 .39 .08 .01 -.02 .013 19631014 .05 -.01 .07 .1 -.21 .013 19631015 .17 -.29 .14 .01 .02 .013 19631016 .89 -.34 .27 .18 -.41 .013 19631017 .14 .1 -.25 .24 -.01 .013 19631018 .09 .11 -.24 .19 -.06 .013 19631021 .03 -.22 -.3 .55 .08 .013 19631022 -.54 .34 -.46 .27 -.33 .013 19631023 .03 -.12 -.05 .1 -.1 .013 19631024 .35 -.07 .47 .07 -.12 .013 19631025 .85 -.43 -.89 .63 -.95 .013 19631028 .41 -.78 -.28 .69 -.41 .013 19631029 -.04 -.29 -.07 .26 .29 .013 19631030 -.79 .43 -.06 -.22 .5 .013 19631031 .21 -.04 .11 .12 -.32 .013 19631101 -.18 .26 .19 -.22 .22 .015 19631104 -.43 .08 .36 -.22 .45 .015 19631106 -.77 .1 .25 -.12 .51 .015 19631107 .33 .05 -.04 -.07 -.23 .015 19631108 .54 .06 .12 .11 -.16 .015 19631111 .2 .22 .15 .13 -.08 .015 19631112 -.37 .25 -.29 .2 -.18 .015 19631113 .05 .05 -.08 .05 -.12 .015 19631114 -.41 .12 -.03 -.11 .35 .015 19631115 -.75 .35 0 -.15 .61 .015 19631118 -.74 .08 -.23 .25 -.04 .015 19631119 .1 -.31 .35 -.17 .07 .015 19631120 .76 -.96 -.35 .26 .53 .015 end format %td date
I have 2 main questions:
first I have been trying to generate a dummy variable Mon=1 if the day is monday and zero otherwise,
second, i want to extract a time period to use it in my analysis, for example: Jan 4, 1969-Dec 31, 1997, and within this period I want to exclude a week of Oct. 15, 1987- Oct. 22, 1987
How can I manage to do that,
I have been trying to create a variable to extract the day by running gen day_of_week = dow(dofc(date)), but it created a variable =5 for all dates.
Your help is highly appreciated
0 Response to extracting days and dates out of database
Post a Comment