If your data are measured in hours or minutes, the process will be essentially identical. You will need to format your time variable in hours or minutes (see help datetime_display_formats). When you use -tsset- you can use the options -clocktime- and -delta(30 minutes)- to specify the time interval you would like (for a worked example see help tsset).
@@jingnanli7325 With panel data you would specify the panel identifier and time variable with *tsset* . For example, *tsset company year, yearly* . Please refer to Example 8 in [TS] tsset for an example with panel data (www.stata.com/manuals/tstsset.pdf). You can also use *tsfill* with panel data. Please type *help tsset* and *help tsfill* to learn more.
Hello I have a panel data series and I need to declare a variable as a time series variable, the problem is that I have several observations for example, for quarter 1, and it doesnt allow me to declare my variable as time series because it says that there are "repeated time values within panel"
Sorry, I'm new to stata. I download FRED's US GDP data. When I want to declare it as time-series, I indicate daten as quarterly time variable. The dataset is based on quarterly numbers. However, stata warns me that it thinks the dates are 'formatted %tdnn/dd/CCYY (a daily period)' and says there are gaps. And I know there aren't. If I fill gaps it creates 90 empty days between each of real ones. I tried to create a new date variable with the same problems. Can you help, please?
This is helpful. However the example appears to be "business week" daily data. If I'm not mistaken there is an option in the date or other time series formatting commands that lets you ignore weekends and holidays, at least based on the US calendar.
I created a business calendar (format mdy). When I wrote: omit date 1/1*, Stata omitted Jan 1st (OK), but also Jan 11(not OK), for all years in the dataset. If I wrote omit date jan 1*, I got the same as above. How can I write the command so that Stata omits only Jan 1st?
Hi, I'm following the steps but it's generating "Date2" with missing variables. Any idea why this is? My "Date" variable is yearly ( 31-12-03) for 356 observations for 4 years between 03-06
Google "DJIA data" - there are many sources for that data on the web. You could also watch the video on "freduse" which would allow you to download the "DJIA" data using one command in Stata.
Hey! Im desperately in need of your help!!! My data set is string daily (without the weekends) I've tried formatting the data using the command: generate time=date(date, "MDY") but it keeps responding with "missing values generated". Please help me i've tried everything and nothing works. My data is 01/01/1991 (MDY) and its called date but i dont know why it isnt working
Hi, thank you for your video. Can I ask you something related to your post? I was trying to convert a string variable (the variable name is obs) into a float variable like you did. But since I have quarterly observations, I used " data(obs, "YQ"). But when I looked at the screen, all of my column cells were filled with one dot. But I just hoped to proceed to do some analysis and I clicked on some statistics option, then I had an error message on the screen. "No observations". How can I fix this problem? I will look forward to your reply. Thanks.
Hi in Excel the dates are written such as: 3/1/2015; 4/1/2015 ... (March, 1, 2015, April 1, 2015...) --> However my data are monthly statistics, how shell I transform these data into monthly without having 30 gaps between each observation?
Please, a query: I am analyzing a time series and I am applying natural logarithms, in one of the variables I have two data "zero" (0), there is no natural logarithm for zero, I ask, to save this problem, can I assign it to the data a number close to zero, example 0.001 (or similar)? Thanks.
Very helpful video, thank you. Can you please tell me if it's possible manage dates like this with additional subdivisions i.e. am, pm night shift (say, on a hospital ward). Thanks
I don't think that would matter too much in terms of plotting a graph. As long as Stata recognises your time variable's name. I'm not an expert by any means, rather more a beginner than anything but try graph twoway line (Y. year) where Y is your Y axis, assuming you're plotting time along the x axis.
Hi, Please, can you explain briefly how can I run cross sectional regrecession in a time series data? please it is very important to me. I would like to calculate the residuals from time series data ,but cross sectionally.
Thank you for your videos, they are all really helpful. Could you explain how to create a timeseries dataset by copying and pasting time series data from excel? I created a 9 provinces dataset with several variables, in a time series of the last 30 years. How can I tell STATA how to recognize the provinces and the different variables?
Sir, I am working with Indian GDP data, which comes out every quarter. But here, Q1 is April-June, Q2 is Jul-Sep, and so on. Please suggest how I can format this kind of data for time-series graphing etc in Stata. Thanks a lot for the video-lesson!
Thank you for your question. Please contact technical services with your question at www.stata.com/support/tech-support/contact. They should be able to assist you with this.
Hi there, Thank you very much for the video. I just have one question, I get the error "repeated time values in sample" as I am looking at the effect on more than one country therefore I have multiple dates. How could I take this into account? Thank you very much! John
Maybe try using the panel command xtset instead? this allows you to designate time variable and an identifying variable - so yours might look like xtset [time/date] [country]. Then Stata recognizes there are values for each country within each time period. As long as you don't have the same country listed with the same date more than once, this will work.
Check out the video "Copy/Paste Data from Excel into Stata" on our channel. The process is identical for any kind of data. For your second question, take a look at the format of this dataset: webuse stocks Once you "tsset" the data, you can graph or model the data as you wish: tsset t, daily tsline toyota nissan honda
You can use the *quarterly()* function to convert quarterly dates stored as strings to a numeric quarterly date. Then, you would use the %tq display format. To learn more about working with dates, please type *help dates* in the Stata Command window.
Thanks a lot Sir. I was messed up for so long until I watched your video. Everything is sorted now. Doing my research paper.
If your data are measured in hours or minutes, the process will be essentially identical. You will need to format your time variable in hours or minutes (see help datetime_display_formats). When you use -tsset- you can use the options -clocktime- and -delta(30 minutes)- to specify the time interval you would like (for a worked example see help tsset).
what if you have more firms. your data is only about one firm. with two firms, one firm has 2009-2020, seond firm has 2009-2020
@@jingnanli7325 With panel data you would specify the panel identifier and time variable with *tsset* . For example, *tsset company year, yearly* . Please refer to Example 8 in
[TS] tsset for an example with panel data (www.stata.com/manuals/tstsset.pdf). You can also use *tsfill* with panel data. Please type *help tsset* and *help tsfill* to learn more.
Hello I have a panel data series and I need to declare a variable as a time series variable, the problem is that I have several observations for example, for quarter 1, and it doesnt allow me to declare my variable as time series because it says that there are "repeated time values within panel"
Did you ever figure this out? I have the same issue.
WOOW!!! THIS VIDEO IS EXTREMELY IMPORTANT AND VERY HELPFUL!!!
THANKS A LOT!
This video was extremely helpful! Thank you so much!
Thank you!! I couldnt get the 'data2' row for ages but turns out I typed in 'Data' instead of 'data' :)
How do I go about sample size and power calculations for a time series analysis design?
Sorry, I'm new to stata. I download FRED's US GDP data. When I want to declare it as time-series, I indicate daten as quarterly time variable. The dataset is based on quarterly numbers. However, stata warns me that it thinks the dates are 'formatted %tdnn/dd/CCYY (a daily period)' and says there are gaps. And I know there aren't. If I fill gaps it creates 90 empty days between each of real ones. I tried to create a new date variable with the same problems. Can you help, please?
This is helpful. However the example appears to be "business week" daily data. If I'm not mistaken there is an option in the date or other time series formatting commands that lets you ignore weekends and holidays, at least based on the US calendar.
Thanks! The option you are looking for is called "business calendars" and you can learn more about them here: www.stata.com/manuals13/dbcal.pdf
I created a business calendar (format mdy). When I wrote: omit date 1/1*, Stata omitted Jan 1st (OK), but also Jan 11(not OK), for all years in the dataset. If I wrote omit date jan 1*, I got the same as above. How can I write the command so that Stata omits only Jan 1st?
Stata interprets * as any value that occurs in that position. Maybe try 1/1/*?
Thank you, this is helpful!
My dates are listed as 2008q1, 2008q2, etc. how do I format these dates?
Same question!
I believe it would be format 'x' %tq
With x being your variable's name
format quarters %td
The argument is for quarterly is "generate date=quarterly(date, "YQ")"
very helpful thank you very much
Hi, I'm following the steps but it's generating "Date2" with missing variables. Any idea why this is? My "Date" variable is yearly ( 31-12-03) for 356 observations for 4 years between 03-06
The same
Google "DJIA data" - there are many sources for that data on the web. You could also watch the video on "freduse" which would allow you to download the "DJIA" data using one command in Stata.
any way to do this with quarterly interval data
My dates are shown as 1998/1999 (start year/end year) and I have no idea how to work with that
same, no string variables
What can I do if my dates are in the format 1950-1951 and so on...?
Thank you!!
what if we do not have to show date..just month and year ?
You can format his date variable using:
What if your dates are in month/day/year form for example 1/1/2018?
did you figure this out?
Hey! Im desperately in need of your help!!! My data set is string daily (without the weekends)
I've tried formatting the data using the command: generate time=date(date, "MDY") but it keeps responding with "missing values generated".
Please help me i've tried everything and nothing works. My data is 01/01/1991 (MDY) and its called date but i dont know why it isnt working
Hi, thanks for sharing the knowledge, could you share the data set used?
Thank you, very helpful!
I have many data / moment,
repeated time values in sample
can I still do it?
Hi, thank you for your video. Can I ask you something related to your post?
I was trying to convert a string variable (the variable name is obs) into a float variable like you did. But since I have quarterly observations, I used " data(obs, "YQ"). But when I looked at the screen, all of my column cells were filled with one dot. But I just hoped to proceed to do some analysis and I clicked on some statistics option, then I had an error message on the screen. "No observations". How can I fix this problem? I will look forward to your reply. Thanks.
same problem here
Hi ,
Same problem here
I wonder if you get to fix it
I look forward for your reply
Thanks
Instead of filling time gaps, can I create business calender?
My dates are 1991q1, 1991q2, 1991q3,... (exactly this format) and they are string variables. How can i use or prepare them for a time series??
Did you end up figuring this out 6 years ago?
Hi in Excel the dates are written such as: 3/1/2015; 4/1/2015 ... (March, 1, 2015, April 1, 2015...) --> However my data are monthly statistics, how shell I transform these data into monthly without having 30 gaps between each observation?
@kolio000 have you figured out how to fix this I am having the same issue?
Please, a query: I am analyzing a time series and I am applying natural logarithms, in one of the variables I have two data "zero" (0), there is no natural logarithm for zero, I ask, to save this problem, can I assign it to the data a number close to zero, example 0.001 (or similar)? Thanks.
Very helpful video, thank you. Can you please tell me if it's possible manage dates like this with additional subdivisions i.e. am, pm night shift (say, on a hospital ward). Thanks
I think that most organizations that deal with 24 hour time cycles (like hospitals) use military time: display clock(5-12-1998 15:15, MDY hm)
Anyone knows how to do epicurve in Stata? For outbreak investigations purposes - cannot find any relevant support. Thanks
Very helpful video, thanks
encode variable, gen(variable1)
Can you fix the string with this command?
My date appears as 2000-01, 2001-02 and so on. How to use them for line graph plot in stata? I have no idea.
I don't think that would matter too much in terms of plotting a graph. As long as Stata recognises your time variable's name.
I'm not an expert by any means, rather more a beginner than anything but try
graph twoway line (Y. year)
where Y is your Y axis, assuming you're plotting time along the x axis.
Hi,
Please, can you explain briefly how can I run cross sectional regrecession in a time series data? please it is very important to me. I would like to calculate the residuals from time series data ,but cross sectionally.
Thank you for your videos, they are all really helpful.
Could you explain how to create a timeseries dataset by copying and pasting time series data from excel?
I created a 9 provinces dataset with several variables, in a time series of the last 30 years. How can I tell STATA how to recognize the provinces and the different variables?
Sir, I am working with Indian GDP data, which comes out every quarter. But here, Q1 is April-June, Q2 is Jul-Sep, and so on. Please suggest how I can format this kind of data for time-series graphing etc in Stata. Thanks a lot for the video-lesson!
Thank you for your question. Please contact technical services with your question at www.stata.com/support/tech-support/contact. They should be able to assist you with this.
Hi there,
Thank you very much for the video. I just have one question, I get the error "repeated time values in sample" as I am looking at the effect on more than one country therefore I have multiple dates. How could I take this into account?
Thank you very much!
John
Hi, did you able to solve this? If yes, hope you could share the method to solve this issue? would really appreciate it. Thank you in advance
Maybe try using the panel command xtset instead? this allows you to designate time variable and an identifying variable - so yours might look like xtset [time/date] [country]. Then Stata recognizes there are values for each country within each time period. As long as you don't have the same country listed with the same date more than once, this will work.
@@kepoh09 try using xtset instead
Why do I get a negative number in converting the date?
a negative number means a date before January 1, 1960
Where can this data be downloaded for practice?
Check out the video "Copy/Paste Data from Excel into Stata" on our channel.
The process is identical for any kind of data.
For your second question, take a look at the format of this dataset:
webuse stocks
Once you "tsset" the data, you can graph or model the data as you wish:
tsset t, daily
tsline toyota nissan honda
It would be helpful if I could be able to download this data so I could follow along. Where can I download this?
You can copy and paste the data from Yahoo Finance here: finance.yahoo.com/q/hp?s=^DJI+Historical+Prices
please upload video for generating time series graph using hourly or minutely data
how about my "date" is quarterly
You can use the *quarterly()* function to convert quarterly dates stored as strings to a numeric quarterly date. Then, you would use the %tq display format. To learn more about working with dates, please type *help dates* in the Stata Command window.
@@statacorp thank you so very much. very helpful
why i got missing values like this
". generate date2 = date(Date,"MY" )
(163 missing values generated)"
"
You left the out of his date function. It should be:
what if I only have month and year, is it possible to do it without day?
Gracias¡¡ eres muy amable
Gretl is far more easy to use software than Stata. Unfortunately, there aren't many video available on UA-cam about it.
Ohh whyyy ?? why y no make it more easy ???
Not helpful