I have a data set that looks like this:
Code:
input int year float(A B C D E) 1950 .3488717 .9319346 .9011049 .6964867 .3295547 1951 .2668857 .4548882 .26436493 .9119344 .4144089 1952 .1366463 .0674011 .8856509 .6795634 .036084738 1953 .028556867 .3379889 .882112 .3549416 .08438109 1954 .8689333 .9748848 .748933 .73897 .009876247 1955 .3508549 .7264384 .9196262 .18740167 .3200437 1956 .07110509 .04541512 .6934533 .3146128 .005196966 1957 .32336795 .7459667 .2154026 .1375693 .22754347 1958 .5551032 .4961259 .8285888 .6537739 .851468 1959 .875991 .7167162 .04421536 .27013195 .9820066 1960 .20470947 .859742 .8630378 .8998394 .032479186 1961 .8927587 .13407555 .3526046 .5734232 .9874847 1962 .5844658 .48844185 .7720399 .11147037 .894106 1963 .3697791 .8712187 .5861199 .4145227 .9684734 1964 .8506309 .7664683 .3227766 .003052204 .23922028 1965 .3913819 .25125554 .17293066 .6659978 .6927336 1966 .11966132 .16636477 .8053644 .3462876 .4884359 1967 .7542434 .7437958 .3060019 .0780235 .4376452 1968 .6950234 .9805113 .21909967 .12758136 .5858005 1969 .6866152 .7295772 .724731 .2297006 .3787092
The data set should then look like this:
Code:
input int year float(A B C D E) 1950 0 1 0 0 0 1951 0 0 0 1 0 1952 0 0 1 0 0
What I think could work is something like this: generate A_biggest == 1 if A > B;C;D;E
But my lack of coding skills makes this a bit difficult for me.
Does anyone have any suggestions of how I can manage this?
Best regards
Andreas Lille
0 Response to Find the the variable with highest value and mark this as 1, while the other variables are marked 0
Post a Comment