Hi everyone,
I'm having an issue while using destring on a pretty standard "year" variable. Here's my code and my attempt at debugging:
Does anyone know why I'm having this error? I used the force option because there are some nonnumeric characters in the date variable, but this error pops up no matter how much cleaning I do.
Thanks!
I'm having an issue while using destring on a pretty standard "year" variable. Here's my code and my attempt at debugging:
Code:
. desc date
Variable Storage Display Value
name type format label Variable label
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
date str13 %13s Date
. charlist(date)
-0123456789Ao��
. ret li
macros:
r(chars) : "-0123456789Ao��"
r(sepchars) : "- 0 1 2 3 4 5 6 7 8 9 A o � � "
r(ascii) : "32 45 48 49 50 51 52 53 54 55 56 57 65 111 177 195 "
. replace date = subinstr(date,"`=char(177)'","",.)
(10 real changes made)
. replace date = subinstr(date,"`=char(195)'","",.)
(10 real changes made)
. charlist(date)
-0123456789Ao
. recast str13 date
. destring date, force replace
alias not allowed
r(101);
end of do-file
r(101);
Thanks!

Comment