ส่งค่าสเกลาร์เป็นอาร์กิวเมนต์ไปยังโปรแกรมนำเข้า Excel

ฉันกำลังพยายามนำเข้า Excel เข้าสู่ Stata โดยอัตโนมัติ นี่คือตัวอย่างที่ไม่ทำงานของฉัน ข้อผิดพลาดแนะนำฉันว่า Stata ไม่ได้ประเมินอาร์กิวเมนต์ของโปรแกรมเป็นสเกลาร์ ฉันจะแก้ไขได้อย่างไร?

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

person Trevor    schedule 22.07.2013    source แหล่งที่มา


คำตอบ (1)


คุณสามารถแก้ไขได้ด้วย:

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

ฉันคิดว่าคุณไม่จำเป็นต้องมีสแลชด้านหน้าสำหรับคำจำกัดความแบบเต็ม

person Dimitriy V. Masterov    schedule 22.07.2013