Hi! I have a dataset with minute data (stock price) which I would like to convert into 30min data intervals. Im not very familiar with Stata but I try to learn it with my thesis. The data is reported in unix time. I have done the following commands:
rename timestamp unixtime
generate double statatime = unixtime * 1000 + mdyhms(1,1,1970,0,0,0)
generate double statatime2 = unixtime * 1000*30 + mdyhms(1,1,1970,0,0,0)
collapse close,by(statatime2)
Variable close = close price
Statatime2 gives me intervals of 30 minutes but the dates are clearly wrong. How do I get my 30 min intervals to respond to the right unixtime? Or is it another more effiecient way to convert my 1 minutes data into 15 min intervals? A step-by-step instruction would be highly preciated!
Thanks for any help!
Related Posts with Convert high frequency data to lower frequency
Why can't we cluster on anything we like?I often get error messages indicating that Stata doesn't like the variable that I have chosen to clu…
Writing a LoopDear Statalist Users, I have multiple txt files and I want to convert them into stata files so that…
stata ttest significanceHi everyone, I have the following dataset Code: * Example generated by -dataex-. To install: ssc…
Best command for cross-classified modelsI'd like to fit a model with student and teacher random effects. The ID variables for students and t…
Problem with reaching 1:n ratio with psmatch2 !Hi everyone, I am trying to perform a 1:4 propensity score matching using the command psmatch2. Aft…
Subscribe to:
Post Comments (Atom)
0 Response to Convert high frequency data to lower frequency
Post a Comment