Good evening,
I just downloaded a dataset containing over a million observations and more than 60 variables. I am currently using Stata SE 16.1. I have two issues that I haven't been able to resolve. Firstly, I have several variable with dates. I have imported the file as a .CVS. Once I do so, the dataset converts the date variables into string variables. I have used the command date(string, td%) and format %tdMDY in order to convert them. It is not working. Could someone help me? I believe the reason it is not working is because I have two formats for the dates in the same variable (that is how the dataset comes), M/D/YY or M/D/YYYY. Could I fix it?
The second problem I have is that I have a variable that contains prices. But the variable price was imported as a string variable. I tried to use the command destring(str1), gen(Price). But it is not working. I believe it is because the variable has commas. It appears as for example 17,567,289 or 1,254, etc... Could someone help me fix it?
I tried to do it before in Excel but the dataset is too large for Excel to handle and when I tried to import it to Stata it didn't allow me. I also used Numbers, but it takes to long to format the variable (I have been doing it for over 10 hours and it seems the app is not responding anymore). Even if I manage to do so in Excel, I cannot copy and paste as the memory use is too great.
I would really appreciate if someone could help me.
Thanks
Related Posts with String Variables to Numeric
putdocx basic summary statisticsI am running Stata 17 SE. I would like to send the output of basic summary statistics commands, nam…
Calculating F-statistic after constrained regressionI have run this unconstrained regression *Model: lcost=ß_1+ß_2loutput+ ß_3plabor+ ß_4lcapital+ß_5lpf…
xtunitroot error 'too many variables specified'Good afternoon. The dataset looks like this: Code: * Example generated by -dataex-. For more info…
How to convert SIC codes into Fama French 12Hello, I am a uni student and I'm terrible with computers. For a project that is due in a week, we a…
Reshape dataset including variables names as an additional variableHello Statalist community, I don't have yet much experience using Stata and hope you can help me wi…
Subscribe to:
Post Comments (Atom)
0 Response to String Variables to Numeric
Post a Comment