* say that the data are in sarah1
gen en = _n
save sarah1,replace
save sarah2,replace
expand 3
rename var1 var2
sort var2
drop en
egen en=seq(), from(1) to(3)
save sarah2,replace
use sarah1
joinby en using sarah2
drop en
l
Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
On Dec 21, 2004, at 2:33 AM, statalist-digest wrote:
I have a 1-variable Stata file like:
var1
A
B
C
and I would like to create all possible combinations of observations
as below:
var1 var2
A A
A B
A C
B A
B B
B C
C A
C B
C C
I would appreciate if you can help me how to create above file.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/