Although quite simple, it took me some time to find this out. So, posting the method to convert strings to numeric in Stata.
A lot of times, we have data on Excel sheet, and when we copy this to Stata Data Editor, few numeric data gets copied as string variable. A lot of this happens for dummy variables. How do you convert these datasets back to numeric so that you can analyze these number?
Go to Data Editor -> Click on Data -> Click on Create or change data -> Click on Other variable-transformation commands -> Click on Convert variables from string to numeric
Then select the dataset to be changed. You can either create an entirely new dataset for the numeric variables (thereby keeping the old dataset intact) or change the original dataset.
A lot of times, we have data on Excel sheet, and when we copy this to Stata Data Editor, few numeric data gets copied as string variable. A lot of this happens for dummy variables. How do you convert these datasets back to numeric so that you can analyze these number?
Go to Data Editor -> Click on Data -> Click on Create or change data -> Click on Other variable-transformation commands -> Click on Convert variables from string to numeric
Then select the dataset to be changed. You can either create an entirely new dataset for the numeric variables (thereby keeping the old dataset intact) or change the original dataset.
No comments :
Post a Comment