Hi there,
I have been trying and searching for a way to generate a new variable =1 if var4 for example start with string "5" and zero for otherwise.
lets suppose there is a variable and its inputs like this:
5194
532
1865
8659
3450
5531
What I want is to generate a new variable that include all observations within which this variable starts with 5 regardless of what come next or how many digits it has. So, in this case the new variable should contain 3 Obs.
Any help is appreciated!
I have been trying and searching for a way to generate a new variable =1 if var4 for example start with string "5" and zero for otherwise.
lets suppose there is a variable and its inputs like this:
5194
532
1865
8659
3450
5531
What I want is to generate a new variable that include all observations within which this variable starts with 5 regardless of what come next or how many digits it has. So, in this case the new variable should contain 3 Obs.
Any help is appreciated!
Comment