I have a set of data, the existing data is as follows:
The two existing problems are as follows:
Question 1. You need to know the number of letters in the string in the var1 variable in each record (or the number of spaces, which are separated by spaces and have no spaces at the beginning and the end), how to find, except for the moss command, I have already used this method made it
Question 2. How to convert the data into the following data? Is there a good way to realize data manipulation?
The target data is as follows:
How to do the above data conversion?
Thank you very much .
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str15 var1 "a" "a b" "a b c d" "a b c d e f" "a b c d e f g h" "a b c" "a b c d" "a b" "a" "a b c d e f" end
The two existing problems are as follows:
Question 1. You need to know the number of letters in the string in the var1 variable in each record (or the number of spaces, which are separated by spaces and have no spaces at the beginning and the end), how to find, except for the moss command, I have already used this method made it
Question 2. How to convert the data into the following data? Is there a good way to realize data manipulation?
The target data is as follows:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float group2 str1 var2 1 "a" 2 "a" 2 "b" 3 "a" 3 "b" 3 "c" 3 "d" 4 "a" 4 "b" 4 "c" 4 "d" 4 "e" 4 "f" 5 "a" 5 "b" 5 "c" 5 "d" 5 "e" 5 "f" 5 "g" 5 "h" 6 "a" 6 "b" 6 "c" 7 "a" 7 "b" 7 "c" 7 "d" 8 "a" 8 "b" 9 "a" 10 "a" 10 "b" 10 "c" 10 "d" 10 "e" 10 "f" end
Thank you very much .
Comment