Dear STATA Forum,
I have the following data and I want to generate a new variable "SDG_L1_C_Merged" that equals the max value in the row of other variables "SDG_L1_C*", or if missing, to show 0.
I hope you can help,
thank you,
G
I have the following data and I want to generate a new variable "SDG_L1_C_Merged" that equals the max value in the row of other variables "SDG_L1_C*", or if missing, to show 0.
I hope you can help,
thank you,
G
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str3(reporter partner) str6 HS6Code int Year float(SDG_L1_CA110 SDG_L1_CA120 SDG_L1_CA130 SDG_L1_CA140 SDG_L1_CA150 SDG_L1_CA190 SDG_L1_CA210 SDG_L1_CA220 SDG_L1_CA310 SDG_L1_CA330 SDG_L1_CA400 SDG_L1_CA420 SDG_L1_CA490 SDG_L1_CA410 SDG_L1_CA320) "EUN" "WLD" "150910" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "150990" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151000" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151110" 2013 . . 12 . 12 12 12 12 12 12 . 12 . 12 12 "EUN" "WLD" "151190" 2013 . . 12 . 12 12 12 12 12 12 . 12 . 12 12 "EUN" "WLD" "151211" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151219" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151221" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151229" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151311" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151319" 2013 . . . . . . . . . . . . . . . "EUN" "WLD" "151321" 2013 . . 12 . 12 12 12 12 12 12 . 12 . 12 12 "EUN" "WLD" "151329" 2013 . . 12 . 12 12 12 12 12 12 . 12 . 12 12 end
Comment