I have a column which is a mixture of numbers and words eg:
Less than 10
Null
More than 30
The above are stored as string values
TRY 1: - I understand this is used for numerical data as it won't work with encode
In order to destring them i have tried:
gen numerical = real (stringvalue)
the column came up with just hyphens - no blue text
then i tried:
TRY 2: - I understand encode should be used for just qualitative data
encode stringvalue, gen (numerical)
Some of them were successfully encoded, some weren't eg Less than 10 was successfully encoded
And I only managed to replace this value with a number 1 the rest I coudln't as they weren't encoded
What am I doing wrong?
Less than 10
Null
More than 30
The above are stored as string values
TRY 1: - I understand this is used for numerical data as it won't work with encode
In order to destring them i have tried:
gen numerical = real (stringvalue)
the column came up with just hyphens - no blue text
then i tried:
TRY 2: - I understand encode should be used for just qualitative data
encode stringvalue, gen (numerical)
Some of them were successfully encoded, some weren't eg Less than 10 was successfully encoded
And I only managed to replace this value with a number 1 the rest I coudln't as they weren't encoded
What am I doing wrong?
Comment