Dear all,
I have been struggling for many days with this topic, I cannot seem to solve it. What I would like to do is create a variable that contains the content of many other variables. The problem lies in the fact that I have a lot of variables that have missing values. I do not want to include those in the concatenated variable that I end up with.
I have, of course, found the concatenate function. However, this only partially solves the problem.
egen CONCAT = concat(var1 var2 var3 var4), p( ; )
Let's see if I can explain this by giving an example of what I would like to get in the end:
500; 102; 565
200; 354
300; 569; 224; 5646
What I end up now with is:
500; 102; 565;
200; 354;.;.
300; 569; 224; 5646
That bit with the "; . ;" is okay if there's only a few variables that I want to concatenate. My number of variables is 200+, however... So ;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;. contains no useful information and should ideally be removed.
Thank you so much for your time!
Kind regards,
Erik
I have been struggling for many days with this topic, I cannot seem to solve it. What I would like to do is create a variable that contains the content of many other variables. The problem lies in the fact that I have a lot of variables that have missing values. I do not want to include those in the concatenated variable that I end up with.
I have, of course, found the concatenate function. However, this only partially solves the problem.
egen CONCAT = concat(var1 var2 var3 var4), p( ; )
Let's see if I can explain this by giving an example of what I would like to get in the end:
500; 102; 565
200; 354
300; 569; 224; 5646
What I end up now with is:
500; 102; 565;
200; 354;.;.
300; 569; 224; 5646
That bit with the "; . ;" is okay if there's only a few variables that I want to concatenate. My number of variables is 200+, however... So ;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;.;. contains no useful information and should ideally be removed.
Thank you so much for your time!
Kind regards,
Erik
Comment