Hello,
I have an issue with importing additional data into my code.
I import a dataset (.dta) that I change to .smcl in the beginning of my code and use it for my analysis. At some point I end up with a column variable of type string, which is a list of different phrases in various languages (about 27000 rows). I want to create another variable with the English translation of those phrases.
I have created an Excel spreadsheet with 2 columns (left = native phrases, right = English translation) with the translations of the unique phrases (about 300 rows), that I attempted to import as a macro and use to translate my initial variable, . However I am experiencing some issues.
1) I was wondering if this is even an efficient way, or if you could recommend an alternative. Is there a similar way to work as with vlookup in Excel?
2) My attempt:
When importing the excel file, I get the error "no; data in memory would be lost", which as I understand means I need to save the existing data before importing a new one. However I can't seem to be able to save it.
my code is:
save "Users/....../...1.smcl", replace
And I get an error saying "log file already open"
Any ideas what I might be doing wrong?
Also, would this delete my existing data? (I don't want to delete it as I need it for further analysis afterwards)
And assuming I manage to import the Excel spreadsheet successfully and keep both that and my initial dataset
How do I achieve the translation.
Thanks in advance
I have an issue with importing additional data into my code.
I import a dataset (.dta) that I change to .smcl in the beginning of my code and use it for my analysis. At some point I end up with a column variable of type string, which is a list of different phrases in various languages (about 27000 rows). I want to create another variable with the English translation of those phrases.
I have created an Excel spreadsheet with 2 columns (left = native phrases, right = English translation) with the translations of the unique phrases (about 300 rows), that I attempted to import as a macro and use to translate my initial variable, . However I am experiencing some issues.
1) I was wondering if this is even an efficient way, or if you could recommend an alternative. Is there a similar way to work as with vlookup in Excel?
2) My attempt:
When importing the excel file, I get the error "no; data in memory would be lost", which as I understand means I need to save the existing data before importing a new one. However I can't seem to be able to save it.
my code is:
save "Users/....../...1.smcl", replace
And I get an error saying "log file already open"
Any ideas what I might be doing wrong?
Also, would this delete my existing data? (I don't want to delete it as I need it for further analysis afterwards)
And assuming I manage to import the Excel spreadsheet successfully and keep both that and my initial dataset
How do I achieve the translation.
Thanks in advance
Comment