Hello, I have a large dataset which I receive in 5 excel files. There is a variable, lets say X, this variable appears as double in some excel files and in others it appears as string. The problem is, they change everyday, for example, Excel 1 might contain X in double format one day and the next day, it might be string. Therefore, the code tostring X, gen(strX) format(%15.0f) does not always work. Is there a way to code this so that I don't have to change the programme every time? perhaps a conditional conversion?
Related Posts with Conditional conversion to string variable
Renaming Matrix Rows With SpacesSuppose I wish to rename the rows of a matrix. Code: clear * cls matrix A = (2,1\3,2) cls loc rn …
dynamic looped regressionsDear Stata colleagues: I am using LASSO for inference. I want to independently assess the causality…
How to use xtcointtest with runby? OR How to do cointegration tests for each individuals separately for panel data?Dear all: I'm trying to use xtcointtest to do cointegration tests for each individuals separately in…
Extracting All Strings After a Word within a Variable NameI have a dataset representing a treated unit (GDP), a series of estimated counterfactuals, (cf) and …
Assigning value from one variable to another if condition is metI have a data manipulation question: I have a dataset with the variables "id_1", "year", and "id_2."…
Subscribe to:
Post Comments (Atom)
0 Response to Conditional conversion to string variable
Post a Comment