Hello

I have data in the following format where each firm is audited by either 1 or two auditors.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 firm str1(aud1 aud2)
"Firm 1"  "A" "" 
"Firm 2"  "B" "A"
"Firm 3"  "B" "D"
"Firm 4"  "A" "E"
"Firm 5"  "C" "" 
"Firm 6"  "C" "B"
"Firm 7"  "D" "F"
"Firm 8"  "E" "" 
"Firm 9"  "E" "A"
"Firm 10" "F" "G"
end
I want to generate an id variable for each auditor variable in such a way that the same auditor appearing in aud1 or aud2 get the same id. In short, I would like my final output like this:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 firm str1 aud1 float unique_id_1 str1 aud2 float unique_id_2
"Firm 1"  "A" 1 ""  .
"Firm 2"  "B" 2 "A" 1
"Firm 3"  "B" 2 "D" 4
"Firm 4"  "A" 1 "E" 5
"Firm 5"  "C" 3 ""  .
"Firm 6"  "C" 3 "B" 2
"Firm 7"  "D" 4 "F" 6
"Firm 8"  "E" 5 ""  .
"Firm 9"  "E" 5 "A" 1
"Firm 10" "F" 6 "G" 7
end
Is there a way to get it done? Please help me out

Warm regards

Amish