Hi,
Please, I have 5 excel files: "File1.xls" to "File5.xls". Each file contains only 1 sheet: "Sheet1"
I want to import and merge them using variable id.
variable id uniquely identifies each observation in the excel files.
Usually, I import each file separately save them .dta, then merge. or use xls2dta to convert to. dta before merging. But I was looking for doing it with loop (foreach or forval), is that possible ? also if I have these files with completely different names (not indexed by numbers) for example instead of "File1.xls" I have "name.xls" and "File2.xls" "age.xls". is that possible?
I'm not also interested to keep the separate .dta files created before the merger
I would much appreciate your assistance on the subject.
Thank you in advance
Related Posts with Using loop to import and merge excel files
IMPORTANT QUESTION: Remove firms if fiscal year-end changesGoodmorning, For my thesis it is very important to remove all firms in my compustat database for wh…
Heckprobit regression with dummy variablesI have done a heckprobit regression on a cross section data. My main explanatory variable is a distr…
Fixed effects, robust standard errors and clustered standard errorsHi, I'm making a difference-in-differences analysis with multiple interaction terms for returns - t…
To generate a new variable to subset a dataset based off number of visit a patient has attendedDear all, Patient number is a key identifier variable. For example Patients have come for 3 visits,…
count number of unique values over a rolling time window defined by a date variableDear Stata community, I'd like to generate a variable that records the number of unique values of a…
Subscribe to:
Post Comments (Atom)
0 Response to Using loop to import and merge excel files
Post a Comment