I have a multiple response variable that may take any combination of responses between 1 to 5 and 97. For instance, the variable may have responses in any of the following (i) 1 only or (ii) 2 and 3, or (iii) 97 only, or (iv) 3, 5, and 97, or (v) 1, 2, 3, 4, 5, and 97, or (vi) any other possible combinations. The variable is in string form with each response separated by a space. I would like to split this variable into 6 different variables for each choices/responses. For instance variable_1, variable_2, ........., variable_97. For each of these individual variables, I want responses in 0 and 1 (true false) format. For example, if a response has values 3 and 5. I want value 1(or true) for variables "var_3" and "var_5" and value 0 (false) for the rest of the variables.
Could anyone kindly suggest a way of splitting the variables in this way in STATA?
Thanks.
Related Posts with Splitting Multiple Response Variable
replace missing data with the mean of a subscaleHi there, I was using the syntax foreach var of varlist * {summ `var' replace `var' = r(mean) if mi…
Drop all observations of a company if it does not meet the requirement at one point in timeHello, I am new to STATA and run into a problem with my dataset which contains companies stock info…
Identification of Common Support using PSMHello, I have 6231 household data as a total number of observations of which 351 of them are classif…
query about nested loops (how to match on GP)?Hello, I am trying to sample for a case-control study based on date of death and matching on GP (pra…
twostepweakiv with panel dataHello, I am running a GMM model using a continuously updated estimator on panel data. My main comman…
Subscribe to:
Post Comments (Atom)
0 Response to Splitting Multiple Response Variable
Post a Comment