This is a very annoying problem and the solution is most definitely very simple.
I would like to create a variable (category) with four values according to the plot below:
Array
I used the codes below
Code:
generate category = 1 if BPS<35.58 | B< 34.77 replace category = 2 if BPS>35.58 | B< 34.77 replace category = 4 if BPS>35.58 | B> 34.77 replace category = 3 if BPS<35.58 | B> 34.77
Date example below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(BPS B category) 35 42 3 30 34 3 38 38 3 38 39 3 30 37 3 34 39 3 36 39 3 25 34 3 37 34 4 37 38 3 34 38 3 40 28 4 36 40 3 34 37 3 35 35 3 44 28 4 38 34 4 40 29 4 44 43 3 41 36 3 37 44 3 33 42 3 39 34 4 41 18 4 39 28 4 40 27 4 36 32 4 37 39 3 37 39 3 42 23 4 41 26 4 36 37 3 39 35 3 38 33 4 31 31 3 35 41 3 32 31 3 35 31 3 32 34 3 34 37 3 32 37 3 35 36 3 34 41 3 34 28 3 34 40 3 31 37 3 36 32 4 35 34 3 32 47 3 37 36 3 32 39 3 32 36 3 35 44 3 37 36 3 34 39 3 41 34 4 37 32 4 39 32 4 39 42 3 38 43 3 32 32 3 36 41 3 36 39 3 34 38 3 30 40 3 34 31 3 31 39 3 32 39 3 31 36 3 33 32 3 36 31 4 37 39 3 38 26 4 36 36 3 37 38 3 35 38 3 33 34 3 36 34 4 34 33 3 33 38 3 32 23 3 40 43 3 38 39 3 38 25 4 29 43 3 35 34 3 46 27 4 32 34 3 35 32 3 43 34 4 35 38 3 38 32 4 43 27 4 35 32 3 41 47 3 32 35 3 37 35 3 37 32 4 37 37 3 28 32 3 end
0 Response to generate four categories from two variables
Post a Comment