Dear All,
I need to import an Excel file to Stata. The data starts at a row N, which is known and starts at column A and proceeds to some column X. The number of rows is unknown. If I let Stata (13.0) to determine the dimensions, it determines the number of rows correctly, but takes too many columns. I believe it has something to do with the way how the files were produced and the data area is marked within the Excel file. Unfortunately I have only one of the files to experiment with, but I anticipate that the other files to be processed with my code will exhibit the same problem.
I have two options in import excel : specify just the top left corner for the data or specify both top left and bottom right corners. Unfortunately I can't just specify 3 out of 4 parameters and let Stata guess the 4th one. Or can I? Is there any trick to specify the limits indicating the starting row, starting and ending column, but omitting the ending row?
At the moment I think I have two workarounds:
1) I could import the file twice, first just to determine the number of rows (specifying only one corner), then to actually import the data (specifying 2 corners);
2) I could import the file (specifying only one corner) and drop the columns that should not belong there.
Both are acceptable, but a straightforward parameter would be much cleaner.
Thank you, Sergiy Radyakin
I need to import an Excel file to Stata. The data starts at a row N, which is known and starts at column A and proceeds to some column X. The number of rows is unknown. If I let Stata (13.0) to determine the dimensions, it determines the number of rows correctly, but takes too many columns. I believe it has something to do with the way how the files were produced and the data area is marked within the Excel file. Unfortunately I have only one of the files to experiment with, but I anticipate that the other files to be processed with my code will exhibit the same problem.
I have two options in import excel : specify just the top left corner for the data or specify both top left and bottom right corners. Unfortunately I can't just specify 3 out of 4 parameters and let Stata guess the 4th one. Or can I? Is there any trick to specify the limits indicating the starting row, starting and ending column, but omitting the ending row?
At the moment I think I have two workarounds:
1) I could import the file twice, first just to determine the number of rows (specifying only one corner), then to actually import the data (specifying 2 corners);
2) I could import the file (specifying only one corner) and drop the columns that should not belong there.
Both are acceptable, but a straightforward parameter would be much cleaner.
Thank you, Sergiy Radyakin
Comment