Dear Statalist,
I have a dataset where part of my variables are political candidates. The variable names are composed of different sub-blocs that identify the characteristics of those politicians. For example, aaabbbccc1, where aaa is their state, bbb is their district, ccc is their affiliation and 1/0 whether they won or not the seat or not.
I would like to know how could I use rowtotal for only certain variables in my dataset that contain a certain letter in a certain position of their name. In particular, how to you rowtotal if the string variable name contains "ccc" only in the 7th to 9th position. I tried using *ccc* but that includes any variable that contains ccc, but I'd like only those that contain ccc in the 7th to 9th position.
Any help on how could I do that?
Thank you very much for the help.
Daniel
I have a dataset where part of my variables are political candidates. The variable names are composed of different sub-blocs that identify the characteristics of those politicians. For example, aaabbbccc1, where aaa is their state, bbb is their district, ccc is their affiliation and 1/0 whether they won or not the seat or not.
I would like to know how could I use rowtotal for only certain variables in my dataset that contain a certain letter in a certain position of their name. In particular, how to you rowtotal if the string variable name contains "ccc" only in the 7th to 9th position. I tried using *ccc* but that includes any variable that contains ccc, but I'd like only those that contain ccc in the 7th to 9th position.
Any help on how could I do that?
Thank you very much for the help.
Daniel
Comment