Hello,
in my dataset i have several variables which either have the value of 1 or are missing. For every row there is only one variable where the value is 1 and not missing.
I want to create a new variable now, that indicates the variable name of the variable that is NOT missing.
this is an example of my data:
now i would like to have a variable, for example called "Firm", as a string that writes Firm94 in first, second, third row, Firm121 in fourth row and so on.
At first i thought this should be pretty straight forward but i somehow cannot wrap my head around it.
Can someone help me with this ?
thank you in advance !
in my dataset i have several variables which either have the value of 1 or are missing. For every row there is only one variable where the value is 1 and not missing.
I want to create a new variable now, that indicates the variable name of the variable that is NOT missing.
this is an example of my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(Firm94 Firm121 Firm133 Firm241 Firm246 Firm301 Firm478 Firm499 Firm522 Firm590 Firm731 Firm742 Firm1310 Firm1672 Firm1843 Firm1910) 1 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . end
now i would like to have a variable, for example called "Firm", as a string that writes Firm94 in first, second, third row, Firm121 in fourth row and so on.
At first i thought this should be pretty straight forward but i somehow cannot wrap my head around it.
Can someone help me with this ?
thank you in advance !

Comment