Unique combination of variables

#1
Hi guys

I have 15000 observations across 7 variables.

I need some help with the code to generate all possible unique combinations of variables.

e.g. if I had 2 variables and 4 observations per variables

V1=a,b,c,d
V2=1,2,3,4

Then, combinations = a 1, a 2, a 3, a 4,b 1, b 2, b 3, b 4, c 1, c 2, c 3, c 4, d 1, d 2, d 3, d 4

Instead of 2 variables and 4 observations, I have 7 variables and 15000 observations
Could someone help please?

Thank you
 
Last edited:
J

Jüri

Guest
#2
I think I have exactly the same problem. I need to combine the values of two variables into the values of a new variable (e.g. value "abc" and "123" would be "abc123" in the new variable). This seems to be an elementary operation but apparently impossible in Stata. At least an hour of googling hasn't given any result.