I am looking to reshape a dataset with courses done by each of the observation. Each individual has done different sets of the course modules even though the goal was to have everyone do all courses. That is to mean, after reshaping, all the possibly completed courses under *course* will be independent variables with missings for what one has not done. I'd wish to use each course as a control in a regression. Here is the MWE data:
I attempted to run the code
But collapsing the *coursetitle* variable generates many variables in the wide format from one course title. That is "02. Growth Midset" becomes 3 different variables in the wide format. Does anyone has any innitial steps I should do?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double pid byte completion str47 coursetitle byte engagement int minutesspent 9703090408089 100 "01. Why Work and Why YOUth Matter" 100 57 9703090408089 97 "02. Growth Mindset" 97 50 9703090408089 49 "03. Know Yourself to Grow Yourself" 49 30 9703090408089 86 "08. Money Management I" 86 38 9110275678088 69 "01. Why Work and Why YOUth Matter" 69 40 9110275678088 81 "02. Growth Mindset" 81 44 9110275678088 7 "03. Know Yourself to Grow Yourself" 7 58 9110275678088 83 "04. Expectations" 83 34 9110275678088 97 "05. Professionalism" 97 33 9110275678088 96 "06. Onboarding - Getting It Right" 96 24 9110275678088 84 "07. Succeeding in the Workplace" 84 38 9110275678088 100 "08. Money Management I" 100 44 9110275678088 96 "09. Money Management II" 96 46 9110275678088 0 "A. CV Prep and Cover Letter" 0 56 9110275678088 100 "S03. Know Your Industry" 100 23 9401080275085 100 "01. Why Work and Why YOUth Matter" 100 97 9401080275085 100 "02. Growth Mindset" 100 51 9401080275085 47 "03. Know Yourself to Grow Yourself" 47 92 9401080275085 83 "04. Expectations" 83 34 9401080275085 100 "05. Professionalism" 100 34 end
I attempted to run the code
Code:
reshape wide completion engagement minutesspent, i(pid) j("coursetitle") string
Comment