Hello Stata-Users,
I'm very new to stata and I've looked for this problem but seem to find only the combination of string variables not observations.
My data set has an ID(which is type:double) and then performancetypes(which is type: str6) which can take several forms and I want to combine them into one.
input double grantid str6 performancetype
1345976 "Abs"
1345976 "Rel"
1345976 "Time"
1345977 "Abs"
1345977 "Rel"
1345977 "Time"
1345978 "Rel"
1345978 "Time"
1345979 "Rel"
Desired Output:
ID Performancetype
1345976 "AbsRelTime"
1345977 "AbsRelTime"
1345978 "RelTime"
1345979 "Rel"
I don't know if this is only possible with collapse command, however if this would work otherwise that`d be great. Because there are several more variables in the data set which should not get lost.
I have tried the following command:
replace performancetype="AbsRelTime" if grantid==grantid & performancetype=="Abs" & performancetype=="Rel" & performancetype=="Time"
But first I don't think this is a clean way to do it, cause i would have to do this with each combination possibility and the error code type mismatch r(109) occurs.
Your help would be very much appreciated.
0 Response to Combine String Observations
Post a Comment