문제

I'm trying to automate excel import into Stata. Here's my nonworking example. The error suggests to me that Stata is not evaluating the program argument as a scalar. How do I fix it?

scalar path = "C:\foo\data\"
scalar filename = "CompanyScores.xls"
scalar xlrange = "B3:AO149"
scalar sheet = "2012-2013 Scores"
scalar fullpath = path+"/"+filename
import excel fullpath, sheet(sheet) cellrange(xlrange) firstrow
도움이 되었습니까?

해결책

You can fix this with:

import excel "`=fullpath'", sheet("`=sheet'") cellrange("`=xlrange'") firstrow

I also think you don't need the front slash the fullpath definition.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top