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
Free 2-day seminar on Stata's sem and gsem commandsHi everyone, over the holidays Instats is offering some free 2-day seminars on Path Modeling includi…
generate event time across yearsDear All, Consider the following data (a duplicate post is here): Code: * Example generated by -dat…
Problems with command asdocHi there, I am trying to create a multiple regression table with the command 'asdoc' for a Tobit mo…
Questions in doing semHi there! I want to conduct an SEM model to test the mediator. However, it shows 'factor-variable op…
Merging more than two data sets using macros and foreach loopHello Everyone, I want to merge three datasets using macros and foreach loop. The file names are 1.…
Subscribe to:
Post Comments (Atom)
0 Response to Splitting Multiple Response Variable
Post a Comment