Hi everyone,
I have a string variable called -model-. I want to solve a problem that is systematic in this database:
I'll start with two small -dataex-:
The variable -num- corresponds to the count of the row's model.
However, I don't understand why we have a different count to a string variable that appear at sight identical.
My aim: I want to have for each model a proper count of it.
I imagine this might be due to spaces or other characters, but I don't know how to harmonise them.
Does anyone knows how can I circumvent this issue, please?
Thank you in advance for your help.
Michael
Edit: I already tried the following, but does not work:
I have a string variable called -model-. I want to solve a problem that is systematic in this database:
I'll start with two small -dataex-:
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str31 model str1 COD_PROPULSION long cilindrada double(potenciafiscal num)
"ARTEON" "0" 1498 11.19 226
"ARTEON" "0" 1498 11.19 150
"ARTEON" "0" 1984 13.25 334
"ARTEON" "0" 1984 13.25 113
"ARTEON" "0" 1984 13.25 45
"ARTEON" "0" 1984 13.25 19
"ARTEON" "1" 1968 13.19 312
"ARTEON" "1" 1968 13.19 29
"ARTEON" "1" 1968 13.19 996
"ARTEON" "1" 1968 13.19 240
"ARTEON" "1" 1968 13.19 37
"ARTEON" "1" 1968 13.19 237
end
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str31 model str1 COD_PROPULSION long cilindrada double(potenciafiscal num)
"BEETLE" "0" 1197 9.78 90
"BEETLE" "0" 1197 9.78 520
"BEETLE" "0" 1197 9.78 10
"BEETLE" "0" 1197 9.78 108
"BEETLE" "0" 1197 9.78 3
"BEETLE" "0" 1197 9.79 1
"BEETLE" "0" 1197 9.79 6
"BEETLE" "0" 1390 10.7 4
"BEETLE" "0" 1390 10.7 4
"BEETLE" "0" 1390 10.71 1
"BEETLE" "0" 1395 0 1
"BEETLE" "0" 1395 10.72 47
end
The variable -num- corresponds to the count of the row's model.
However, I don't understand why we have a different count to a string variable that appear at sight identical.
My aim: I want to have for each model a proper count of it.
I imagine this might be due to spaces or other characters, but I don't know how to harmonise them.
Does anyone knows how can I circumvent this issue, please?
Thank you in advance for your help.
Michael
Edit: I already tried the following, but does not work:
Code:
replace model = itrim(trim(model))
Comment