I have a string variable that contains a number of days: "3 days", "76 days" and so on.
I want to extract the number part of this and put it into a new numeric variable.
I have started with removing the space:
so it now reads: "3days", "76days"
I have then tried to extract it with forvalues but cannot get it to work. Any suggestions?
I want to extract the number part of this and put it into a new numeric variable.
I have started with removing the space:
Code:
replace duration = subinstr(duration, " ", "", .)
I have then tried to extract it with forvalues but cannot get it to work. Any suggestions?

Comment