Hello,
I'm trying to destring the ID variable into numeric since I need to merge it with my master data which has the same variable into numeric form. In my master data I didn't have any issue turning that string into numeric using the following command.
However, in my using data despite using the same command above to turn the same variable in the using data to numeric I'm having the following issue.
My master data has the same variable like the following which I could successfully destring without any issue.
Could you help how else I can clean it so that I can finally desiring it ? I took one step more to clean the variable. Though, it showed 75 changes , still the problem persists. I think in my using data below I need to get rid of the decimal and the trailing 0. But, I'm not sure how.
I'm trying to destring the ID variable into numeric since I need to merge it with my master data which has the same variable into numeric form. In my master data I didn't have any issue turning that string into numeric using the following command.
Code:
destring id, replace
My master data has the same variable like the following which I could successfully destring without any issue.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double id 20120246951 20200247715 20170050877 20170275197 20170197384 20170197870 20220403806 20120321483 20100291496 20230167018 end
Could you help how else I can clean it so that I can finally desiring it ? I took one step more to clean the variable. Though, it showed 75 changes , still the problem persists. I think in my using data below I need to get rid of the decimal and the trailing 0. But, I'm not sure how.
Code:
replace id = subinstr(id, ",", "", .) // Remove commas (75 real changes made) destring id, replace id: contains nonnumeric characters; no replace
Code:
* Example generated by -dataex-. For more info, type help dataex clear input strL id "20210012690.0" "20200326458.0" "20200075033.0" "20200075034.0" "20200075035.0" "20200075035.0" "20200075036.0" "20200075036.0" "20200075037.0" "20200075038.0" end
Comment