Hi Statalist,
I wanted to append several Excel files from different folders into one dataset using XLS2DTA.
All my variables are located in row 6, and I wanted to add a new variable (schoolid) from cell C3.
This is my data source from the Excel forms.
Here's my code:
clear
set more off
cd "C:\Users\School\SY2023-2024"
xls2dta, gen (source schoolid) save("$temp") recursive replace : import excel "C:\Users\School\SY2023-2024", cellrange(A6) firstrow case(lower)
local school_id = F[3] //not working/error
gen schoolid = `school_id' // not working/error
xls2dta, clear : append
Thank you in advance.
I wanted to append several Excel files from different folders into one dataset using XLS2DTA.
All my variables are located in row 6, and I wanted to add a new variable (schoolid) from cell C3.
This is my data source from the Excel forms.
A | B | C | D | E | F | G | H |
1 | School Form 1 | ||||||
2 | Form 1, Master List | ||||||
3 | School ID | 133068 | REGION 1 | Division | |||
4 | School Name | ABDC ELEM SCHOOL | School Year | 2023 | |||
5 | |||||||
6 | LRN | NAME | SEX | BIRTHDATE | AGE | MOTHER TONGUE | Ethnic Group |
7 | |||||||
8 | 1330 | AAAAAAAAAAAAA | M | 10-05-2015 | 7 | Yakan | Yakan |
9 | 6822 | BBBBBBBBBBBBBB | M | 01-10-2010 | 13 | Yakan | Yakan |
10 | 1820 | CCCCCCCCCCCCCC | M | 03-10-2016 | 7 | Yakan | Yakan |
clear
set more off
cd "C:\Users\School\SY2023-2024"
xls2dta, gen (source schoolid) save("$temp") recursive replace : import excel "C:\Users\School\SY2023-2024", cellrange(A6) firstrow case(lower)
local school_id = F[3] //not working/error
gen schoolid = `school_id' // not working/error
xls2dta, clear : append
Thank you in advance.
Comment