Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: how to get monthly values from Bimonthly data |

Date |
Fri, 3 Aug 2012 00:44:24 +0100 |

No; I mean -expand 2- as I said.

Thank you Nick. I suppose that when you say double up you mean to divide by 2. Am I right? The data that I have are stocks rather than flows. So, I have to interpolate instead of spliting. thanks On 7/31/12, Nick Cox <njcoxstata@gmail.com> wrote:That wasn't clear. So, you will need to double up. If monthly dates go up in steps of 2 expand 2 bysort date : replace date = date + 1 if _n == 2 On Tue, Jul 31, 2012 at 12:45 PM, sabbas gidarokostas <sabbasgidarokostas@googlemail.com> wrote:thanks Nick for your reply and the useful code. But I need toconvertthese values to monthly data because the rest of my data are only monthly values. cheers On 7/31/12, Nick Cox <njcoxstata@gmail.com> wrote:I would leave these data almost as they are. What you can do is gen year = real(substr(dates, -4, 4)) gen period = substr(dates, 1, 2) gen month = cond(per == "JF", 1, cond(per == "MA", 3, cond(per =="MJ", 5, cond(per == "JA", 7, cond(per == "SO", 9, cond(per =="ND",11, .)))))) gen date = ym(year, month) tsset id date , delta(2) The key point is that you have bimonthly data and that's fine. Nodoubling up or interpolation is needed; in fact that can onlyproducea spurious increase in your sample size.Some people would undoubtedly prefer -recode- for the mapping"JF" -> 1,etc. Nick On Fri, Jul 27, 2012 at 3:48 AM, sabbas gidarokostas <sabbasgidarokostas@googlemail.com> wrote:Dear all, I have the following panel data set clear all input str8 (id text dates values1 values2 ) "1" "ot" " " "" " " "1" "wt" " " "" " " "1" "rt" "MA 2005" "32.4" "2.5" "1" "gh" "MJ 2005" "82.3" "12.5" "1" "bg" "JA 2005" "2.5" "24.5" "1" "se" "SO 2005" "82.5" " " "1" "cv" "ND 2005" "62.3" "26.3" "1" "cv" "JF 2006" "12.2" "22.3" "1" "cv" "MA 2006" "22.1" "2.4" "2" "ot" " " " " " " "2" "wt" " " " " " " "2" "rt" "MA 2005" "2" "gh" "MJ 2005" "32.3" "23.5" "2" "bg" "JA 2005" "52.4" "22.3" "2" "se" "SO 2005" "82.9" "22.5" "2" "cv" "ND 2005" " " "2.5" "2" "cv" "JF 2006" "332.4" " " "2" "cv" "MA 2006" "312.4" "21.5" end The above data set is a sample.Basically,I have 30000 individuals and instead of the last 2columnsthat contain the numbers I have 29 such columns. The data set refers to bimontly values. Is there a way to convert the above data to montly data?Specifically, What I think is that first I have to split thedates asfollows M/2005 A/2005 M/2005 J/2005 and so forth and then to convert them to 3/2005 4/2005 6/2005 and so forth. So regarding the first 3 columns I should get "1" "ot" " " "1" "wt" " " "1" "rt" "3/2005" "1" "rt" "4 2005" "1" "gh" "5/2005" "1" "gh" "6/2005"and so forth.I am not exactly sure how to handle the last twocolumns,though(numerical values)I think that one way would be to divide the bimonthly values by2. ThenI get "1" "ot" " " "1" "wt" " " "1" "rt" "3/2005" "32.4/2" "2.5/2" "1" "rt" "4 2005" "32.4/2" "2.5/2" "1" "gh" "5/2005" "82.3/5" "12.5/5""1" "gh" "6/2005" "82.3/5""12.5/5"I am not sure that this makes sense as I have repeated valuesfor twoconsequtive months. Another way would be interpolation? Any code provided is greatly appreciated.* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: how to get monthly values from Bimonthly data***From:*sabbas gidarokostas <sabbasgidarokostas@googlemail.com>

- Prev by Date:
**Re: st: how to get monthly values from Bimonthly data** - Next by Date:
**st: how to write byable programs that call mata?** - Previous by thread:
**Re: st: how to get monthly values from Bimonthly data** - Next by thread:
**st: how to write byable programs that call mata?** - Index(es):