My dataset is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(Individual y) 1 10 2 15 end
Here, I have data by individual identifier (Individual), for a variable of interest y. I wish to expand this downward, to contain another variable, which takes on 2 distinct values. For both of these values of this other variable, x, I would like to retain the duplicate value of y. Essentially, the final dataset that I would like to produce resembles:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(Individual y) str10 x 1 10 "Category 1" 1 10 "Category 2" 2 15 "Category 1" 2 15 "Category 2" end
Many thanks,
CS
0 Response to Expanding dataset to create pairwise combinations
Post a Comment