Command multires
allows parsing composite strings.
For example, in a survey on programming languages, participants were asked about which programming languages they prefer. Variable c1
(see the attached image) contains respondents' preferred software under composite strings. Each composite string includes single texts, separated by parsing character /
. To facilitate data analysis, it is necessary to split the composite string variable into binary variables associated with programming languages.
multires varlist [if exp] [in range] using filename [, PARSing(string)]
in which:
filename
: the directory contains the original data.parsing
(orpars
): a parsing character.filename_split
: the final dataset contains binary variables.
Note:
- You need to open your dataset before running the command as the syntax always requires a list of key variables.
- If the
id
variable already exists in your original dataset, it will be renamedold_id
in final datasetfilename_split
.
Example:
use study, clear
multires c3 c4 using "./study", pars(",")
use study, clear
multires c5 c6 if id <= 10 using "./study"
multires c1 c2 if id <= 10 using "./study", pars("/")
net install multires, from(https://raw.githubusercontent.com/mtrihoang/multires/master) replace
help multires