Dear STATA users,
I'm importing the excel file with multiple worksheets. In each worksheet the number of variables vary. The last variable doesn't have a name but it has the values(grades at some university), something like 20/28, 23/28, 21/28, 25/28 and so on. I tried to drop the variables if it contains the "/" in it. But some error occurs.
The code is this:
cd "C:\Users\yerbolat.assylbekov\Documents\IR\IR Projects\Attendance Records\Datasets\Raw\Fall 2013"
set more off
clear
import excel using "Attendance Fall 2013_", describe
forvalues sheet=1/`=r(N_worksheet)' {
local sheetname=r(worksheet_`sheet')
import excel using "Attendance Fall 2013_", sheet("`sheetname'") allstring clear
gen course = B[1]
order course, first
drop in 1/4
*drop if A=="Student ID"
ds, has(type string)
foreach var of varlist `r(varlist)' {
count if regexm(`var',"/")
if r(N)>0 {
drop `var'
}
save "`sheetname'", replace
}
}
It shows "worksheet . not found".
Could you please help me with that?
I'm importing the excel file with multiple worksheets. In each worksheet the number of variables vary. The last variable doesn't have a name but it has the values(grades at some university), something like 20/28, 23/28, 21/28, 25/28 and so on. I tried to drop the variables if it contains the "/" in it. But some error occurs.
The code is this:
cd "C:\Users\yerbolat.assylbekov\Documents\IR\IR Projects\Attendance Records\Datasets\Raw\Fall 2013"
set more off
clear
import excel using "Attendance Fall 2013_", describe
forvalues sheet=1/`=r(N_worksheet)' {
local sheetname=r(worksheet_`sheet')
import excel using "Attendance Fall 2013_", sheet("`sheetname'") allstring clear
gen course = B[1]
order course, first
drop in 1/4
*drop if A=="Student ID"
ds, has(type string)
foreach var of varlist `r(varlist)' {
count if regexm(`var',"/")
if r(N)>0 {
drop `var'
}
save "`sheetname'", replace
}
}
It shows "worksheet . not found".
Could you please help me with that?
Comment