Hello,

my dataset contains half yearly data from 2000 - 2018 which is written as 2000h1 or 2000h2. The last two characters indicate the first or second half of the year.

I want to generate a dummy variable which tags all observations from the first half (XXXXh1). I tried for several days to come up with a solution but could not figure it out.

Can someone help me to find a solution for this problem?

Thanks for the help

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 gvkey float half_year
"001004"  80
"001004"  81
"001004"  82
"001004"  83
"001004"  86
"001004"  87
"001004"  88
"001004"  89
"001004"  90
"001004"  91
"001004" 101
"001004" 103
"001004" 104
"001004" 105
"001004" 106
"001004" 107
"001004" 108
"001004" 109
"001004" 110
"001004" 111
"001004" 112
"001004" 113
"001004" 114
"001004" 115
"001004" 116
"001013"  80
"001013"  81
"001013"  82
"001013"  83
"001013"  84
"001013"  85
"001013"  86
"001013"  87
"001013"  88
"001013"  89
"001013"  90
"001013"  91
"001013"  92
"001013"  93
"001013"  94
"001013"  95
"001013"  97
"001013"  98
"001013"  99
"001013" 100
"001013" 101
end
format %th half_year