Dear Altruistic,
I'm using Stata 13. My data set is in following formation
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte SpecID long LabID str42 Orgid str10 Patid str1 Sex int(Date Age) byte(Agem Aged) str1(Tetracycline Ampicillin Chloramphenicol Gentamicin Cotrimoxazole NalidixicAcid)
6 1609648 "Staphylococcus haemolyticus" "JAN1800245" "M" 1 50 0  0 "S" ""  "" "R" "R" ""
4 1609605 "Proteus species"             "JAN1800054" "F" 1 40 0  0 ""  "R" "" "R" "R" "R"
1 1609631 "Burkholderia cepacia"        "JAN1800170" "M" 1 66 0  0 ""  ""  "" "R" "S" ""
7 1609351 "Escherichia coli"            "JAN1800170" "M" 1 66 0  0 ""  "R" "" "R" "R" "R"
4 1609670 "Enterobacter cloacae"        "JAN1800282" "F" 1 66 0  0 ""  ""  "" "S" "S" "S"
4 1609625 "Enterococcus faecalis"       "JAN1800135" "F" 1 66 0  0 "R" ""  "" ""  ""  ""
6 1609692 "Acinetobacter species"       "JAN1800306" "F" 1 80 0  0 ""  "R" "" "R" "R" ""
4 1609632 "Providencia rettgeri"        "JAN1800170" "M" 1 66 0  0 ""  "R" "" "R" "R" "R"
3 1609652 "Campylobacter species"       "JAN1800232" "M" 1  9 6 23 "R" "S" "" ""  "R" ""
6 1609626 "Escherichia coli"            "JAN1800159" "M" 1 38 0  0 ""  "R" "" "R" "R" "R"
end
format %td Date
label values SpecID SpecIDl
label def SpecIDl 1 "Blood", modify
label def SpecIDl 3 "Stool", modify
label def SpecIDl 4 "Urine", modify
label def SpecIDl 6 "PUS", modify
label def SpecIDl 7 "Tracheal aspirate", modify
Here the problem is Date variable which entered as numerical value eg. 1= 1st January, 2= 2nd January, 3= 3rd January.....365= 31st December but not in Stata recommended format. So I recoded in following way to get the month
Code:
gen Month= Date
recode Month (min/31=1) (32/59=2) (60/90=3) (91/120=4) (121/151=5) (152/181=6) ///
             (182/212=7) (213/243=8) (244/273=9) (274/304=10) (305/334=11) (335/365=12)
label define Monthl 1 "Jan" 2 "Feb" 3 "Mar" 4 "Apr" 5 "May" 6 "Jun" 7 "Jul" 8 "Aug" 9 "Sep" ///
                    10 "Oct" 11 "Nov" 12 "Dec"
label values Month Monthl
I have searched related posts but didn't find anything like this so tried to use Month but it's provided error with "one data point is multiple time" So my questions are
1. Is it possible to convert this "Date" variable to Stata formated data variable and how?
2. If not, how can I work with Month variable to Stata formated time series variable?

Thanks,
Rayhan