Hi All,

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
Here, all I have done is expand the dataset downward, and attributed this new variable x, which contains 2 categories. There are multiple ways to do this- I was wondering if there is one which is more efficient than -joinby-, which may require me to create an auxiliary dataset.


Many thanks,
CS