Hello,
I was modifying the data in another thread, but the issues below are different from the original question, so I'm posting this in a new thread.
I have a time series trend for Hosuing Prices interest over time from the states of USA. And I have three different issues, the first two being very related, and the third.
So from the data i have below, which is monthly:
a) is it possible to tell stata to aggregate all the monthly data into a yearly data Variable? And is it possible to save this in another file? In the end I need two seperate files, one with the monthly data per state and the other one with the yearly data per state.
b) How can I tell stata to calculate monthly (and yearly) growth rates of each state into a new variable in a time series? With panel data I’ve been able to do it using the bysort command, but I don’t see how to do it with a time series.
c) When graphing I do two different types of graphs:
graph twoway line Ohio month
twoway (tsrline gdp officials, lcolor(red) lpattern(solid) connect(direct))
The first graph, for an individual time series is fine. However, the second line of code, once I proceed to graph it, doesn’t allow me to edit it using the graph editor, to chose two different colors for the two different states. How could I create a time series graph over time for two different states with two different colors?
The code below:
The first variable is a monthly variable that starts January 2004. In the code I have it's converted into a year monthly structure, so it should be the same.
The observations in the states, are monthly interest of Housing Prices in google trends.
input float month byte(Ohio Utah Texas Vermont NorthDakota)
528 72 0 26 0 0
529 35 0 25 0 76
530 90 0 100 0 100
531 68 0 24 0 0
532 31 95 11 0 70
533 100 0 22 0 0
534 67 98 52 100 0
535 30 0 26 0 0
536 42 0 68 0 0
537 28 83 31 0 0
538 0 86 33 0 0
539 27 0 20 64 0
540 69 0 17 59 0
541 47 70 49 0 0
542 52 60 31 0 44
543 23 68 13 0 95
544 20 0 38 53 0
545 46 63 31 0 0
546 33 63 26 0 0
547 62 58 21 56 0
548 0 52 7 0 41
549 35 96 31 0 0
550 35 0 10 0 0
551 85 47 15 0 0
552 30 0 19 0 0
553 30 43 22 0 0
554 67 72 25 0 0
555 51 40 57 37 0
556 80 0 51 37 0
557 15 83 23 41 0
558 43 60 39 0 0
559 52 36 29 0 0
560 32 87 20 0 0
561 46 47 29 33 0
562 34 31 23 0 0
563 23 31 28 0 0
564 29 68 24 41 0
565 30 85 17 43 0
566 56 0 34 0 0
567 38 52 30 0 20
568 31 51 28 38 0
569 34 27 33 0 0
570 14 39 28 0 0
571 35 25 23 41 0
572 22 24 37 37 36
573 43 43 37 0 16
574 23 22 24 34 0
575 49 34 22 0 0
end
format %tm month
[/CODE]
Thank you!
I was modifying the data in another thread, but the issues below are different from the original question, so I'm posting this in a new thread.
I have a time series trend for Hosuing Prices interest over time from the states of USA. And I have three different issues, the first two being very related, and the third.
So from the data i have below, which is monthly:
a) is it possible to tell stata to aggregate all the monthly data into a yearly data Variable? And is it possible to save this in another file? In the end I need two seperate files, one with the monthly data per state and the other one with the yearly data per state.
b) How can I tell stata to calculate monthly (and yearly) growth rates of each state into a new variable in a time series? With panel data I’ve been able to do it using the bysort command, but I don’t see how to do it with a time series.
c) When graphing I do two different types of graphs:
graph twoway line Ohio month
twoway (tsrline gdp officials, lcolor(red) lpattern(solid) connect(direct))
The first graph, for an individual time series is fine. However, the second line of code, once I proceed to graph it, doesn’t allow me to edit it using the graph editor, to chose two different colors for the two different states. How could I create a time series graph over time for two different states with two different colors?
The code below:
The first variable is a monthly variable that starts January 2004. In the code I have it's converted into a year monthly structure, so it should be the same.
The observations in the states, are monthly interest of Housing Prices in google trends.
input float month byte(Ohio Utah Texas Vermont NorthDakota)
528 72 0 26 0 0
529 35 0 25 0 76
530 90 0 100 0 100
531 68 0 24 0 0
532 31 95 11 0 70
533 100 0 22 0 0
534 67 98 52 100 0
535 30 0 26 0 0
536 42 0 68 0 0
537 28 83 31 0 0
538 0 86 33 0 0
539 27 0 20 64 0
540 69 0 17 59 0
541 47 70 49 0 0
542 52 60 31 0 44
543 23 68 13 0 95
544 20 0 38 53 0
545 46 63 31 0 0
546 33 63 26 0 0
547 62 58 21 56 0
548 0 52 7 0 41
549 35 96 31 0 0
550 35 0 10 0 0
551 85 47 15 0 0
552 30 0 19 0 0
553 30 43 22 0 0
554 67 72 25 0 0
555 51 40 57 37 0
556 80 0 51 37 0
557 15 83 23 41 0
558 43 60 39 0 0
559 52 36 29 0 0
560 32 87 20 0 0
561 46 47 29 33 0
562 34 31 23 0 0
563 23 31 28 0 0
564 29 68 24 41 0
565 30 85 17 43 0
566 56 0 34 0 0
567 38 52 30 0 20
568 31 51 28 38 0
569 34 27 33 0 0
570 14 39 28 0 0
571 35 25 23 41 0
572 22 24 37 37 36
573 43 43 37 0 16
574 23 22 24 34 0
575 49 34 22 0 0
end
format %tm month
[/CODE]
Thank you!
Comment