Hello
So, i'm working on a pretty big dataset for a Norwegian insurance company, and I wanted to change one variable in regards to its observations, or rather what the value Stata "reads" from it. Initially the observations were string and essentially showed "Expired" for an insurance offer that was no longer valid, "rejected" for a rejected insurance offer (by the company) and "accepted" was just missing values.
I started off using "decode" which made "expired" = 1, rejected = 2 and "accepted" = "." (Just a period). I do not really need the "rejected" observations so i essentially want to make the "expired" = 0 and "accepted" = 1. The variable name is "avsluttet_aarsak" (Which loosely translates to "reason for termination/closure")
I used the code:
sort avsluttet_aarsak
replace avsluttet_aarsak = 0 in 1/762621. --> Which worked for the "expired" observations, but when i wrote:
replace avsluttet_aarsak = 1 in 76262/1500403 --> then all the "accepted" observations became "rejected".
I assume this is because the underlying value that the "rejected" observations have is 1, due to the initial decoding, and this is why that happens.
Does anyone know of an easier and better way of doing this? I'm quite new to Stata so any help/input would be much appreciated
0 Response to Changing the value of many observations
Post a Comment