Bookmark and Share

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]

st: From: sabbas gidarokostas <[email protected]>


From   [email protected]
To   statalist <[email protected]>
Subject   st: From: sabbas gidarokostas <[email protected]>
Date   Fri, 27 Jul 2012 10:41:48 +0200

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 2 columns
that 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 the dates as follows

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 two columns,
though(numerical values)

I think that one way would be to divide the bimonthly values by 2. Then I 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 values for two
consequtive months.

Another way would be interpolation?

Any code provided is greatly appreciated.

thanks
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index