上机实验12Eviews表格操作.docx
《上机实验12Eviews表格操作.docx》由会员分享,可在线阅读,更多相关《上机实验12Eviews表格操作.docx(19页珍藏版)》请在冰豆网上搜索。
上机实验12Eviews表格操作
上机实验12:
Eviews7中的表格操作
一、创建表格
建立工作文件后,点击菜单objects建立表格,或者用table命令直接创建表格,或者用freeze命令将其他对象的表格视图定格/冻结成表格。
例如
table(3,4)tb
将创建3行4列的表格,名称是tb。
freeze(tb)eq1.results
将方程对象eq1的估计结果用表格视图显示出来,并定格成表格,名称是tb。
双击或用showtb打开表格,认识表格窗口的各项按钮。
按钮Grid+-添加格线。
二、填表
例如tb(1,1)=”ANewtable”文本要用双引号。
tb(2,3)=500
setcell命令可以进行一定的格式设置,如
setcell(tb,2,2,”tabletitle”,”c”)
如果没有格式设置,缺省下,字符串左对齐,数值右对齐。
C表示居中,l表示左对齐,r表示右对齐。
setformat命令提供了更丰富的格式设置。
三、格式化表格
用命令可以对表格进行各种格式设置,例如行高和列宽、背景色和边框,以及格子内容格式化时的字体、字号和颜色,此外还可以横向合并单元格。
单行用数字表示、单列用字母表示(类似于Excel)。
单个格子的表示,例R3C2\3,2\B3
格子范围的表示,例R2C1:
R10C3\R2C1,R10C3\2,1,10,3\A2:
C10\2,A,10,C
行高和列宽
tb.setheight
(2)3
tb.setheight(5:
8)1.5
tb.setwidth(d)15
tb.setformat(2,1,10,3)f.2
tb.setformat(2,1,10,3)f(0.2)
都是设置第2行第1列到第10行第3列的所有数值只显示到小数点后两位数字,第二个设置负数用括号的方式显示。
数值的显示格式
设置
说明
设置
说明
g
有效位数
e
科学计数法
f
固定小数位
p
百分比
c
固定显示的位数
r
分数
g.5表示只取5位有效数字。
对齐与缩进
水平方向可以设置成auto\left\right\center
垂直方向可以设置成top\middle\bottom
tb.setjust(2,1,10,3)topleft
tb.setindent(2,1,10,3)3
字体、字号、颜色和样式都可以设置
tb.setfont(2,2)“timesnewroman”+I+s12pt
b:
粗体,i:
斜体,s:
单划线,u:
下划线
tb.setfont(2,2)+u–s
tb.settextcolor(2,2)orange
背景和边框
tb.setfillcolor(2,2)blue填充成蓝色背景
tb.setlines(b2:
d10)+a–h–v对所有边框都加线,再去掉所有内部水平框线和竖直框线。
tb.setlines(b2:
d10)+a–I先加所有框线,再去掉所有内部框线
tb.setlines(b2:
d10)+o只对外轮加框线
选项
说明
选项
说明
t
顶边框
o
外部边框
b
底边框
v
内部垂直边框
l
左边框
h
内部水平边框
r
右边框
a
所有边框
i
内部边框
d
中间双划线
tb.setlines(4)+d第4行中间加双线
tb.setlines(@all)–a去掉所有框线
tb.setlines(4)–d去掉第4行的双线
合并和注释
单元格可以加注释,注释的信息平时不显示,只有当鼠标停留在该格子时,才显示注释信息。
例如
ment(A1)”Important++”
去掉注释ment(A1)
还可以把同一行相邻的表格合并,假设第一行的前三个格子都已经有内容,则合并命令为
tb.setmerge(A1:
C1)
例子
wfopendemo
smpl1952q11992q4
equationeq1.lslog(m1)clog(gdp)rsdlog(pr)
freeze(tb)eq1.results
showtb
tb.setfont(20,1)12pt
tb.settextcolor(20,1)red
tb.setheight(14)2.5
tb.settextcolor(7)blue
tb.setfillcolor(e9:
e12)yellow
tb.setfillcolor(13)@rgb(200,230,118)
tb.setlines(b9:
b12)+o
tb.setfont(b19)+s
tb.setjust(a14)right
tb.setfont(a14)+b+i
tb.setformat(e14:
e19)f(.3)
tb(22,1)="thisismdifiedfordemostration"
tb(21,4)=@now
tb.setformat(21,4)"yyyy-mm-dd"
tb.setmerge(a22:
c22)
DependentVariable:
LOG(M1)
Method:
LeastSquares
Date:
04/21/13Time:
17:
34
Sample(adjusted):
1952Q21992Q4
Includedobservations:
163afteradjustments
Variable
Coefficient
Std.Error
t-Statistic
Prob.
C
1.312383
0.032199
40.75850
0.0000
LOG(GDP)
0.772035
0.006537
118.1092
0.0000
RS
-0.020686
0.002516
-8.221196
0.0000
DLOG(PR)
-2.572204
0.942556
-2.728967
0.0071
R-squared
0.993274
Meandependentvar
5.692
AdjustedR-squared
0.993147
S.D.dependentvar
0.670
S.E.ofregression
0.055485
Akaikeinfocriterion
(2.921)
Sumsquaredresid
0.489494
Schwarzcriterion
(2.845)
Loglikelihood
242.0759
Hannan-Quinncriter.
(2.890)
F-statistic
7826.904
Durbin-Watsonstat
0.141
Prob(F-statistic)
0.000000
734978.7
thisismdifiedfordemostration
打印和导出
打印表格用print命令,例如print(l)tb将横向打印表格的内容。
用save命令导出。
例如tb.save(t=csv,n=-999)mytab
tb.save(r=r2c2:
r10c3,t=html,s=0.8)c:
\html\mytab
选项t=csv逗号分隔的csv文件
t=txt制表符分隔的文本文件
t=rtfrtf文件
t=htmlhtml文件
命令
说明
命令
说明
Setfillcolor
设置背景色
Setjust
设置对齐方式
Setfont
设置字体
Setlines
设置边框和字符双划线
Setformat
设置显示的格式
Setmerge
合并格子
Setheight
设置行高
Settextcolor
设置字体颜色
setindent
设置缩进量
setwidth
设置列宽
Tablefreezesavecommentprintsetcelltb(a,b)
命令参考CommandReference
Commands
ThefollowinglistsummarizestheEViewsbasiccommands.
Commandsforworkingwithmatrixobjectsarelistedin"MatrixLanguageReference",andEViewsprogrammingexpressionsaredescribedin"ProgrammingLanguageReference".
AlistofviewsandproceduresavailableforeachEViewsobjectmaybefoundin"ObjectViewandProcedureReference".
CommandActions
dodexecuteactionwithoutopeningwindow.
freezecreateviewobject.
printprintview.
showshowobjectwindow.
GlobalCommands
cdchangedefaultdirectory.
exitexittheEViewsprogram.
outputredirectprinteroutput.
paramsetparametervalues.
rndseedsettheseedoftherandomnumbergenerator.
smplsetthesamplerange.
ObjectCreationCommands
alphaalphaseries.
coefcoefficientvector.
dataenterdatafromkeyboard.
equationequationobject.
factorfactoranalysisobject.
frmlnumericoralphaseriesobjectwithaformulaforauto-updating.
genrnumericoralphaseriesobject.
graphgraphobject-createusingagraphcommandorbymergingexistinggraphs.
groupgroupobject.
linkseriesoralphalinkobject.
logllikelihoodobject.
matrixmatrixobject.
modelmodelobject.
poolpoolobject.
rowvectorrowvectorobject.
samplesampleobject.
scalarscalarobject.
seriesnumericseries.
spoolspoolobject.
sspacesspaceobject.
stringstringobject.
svectorsvectorobject.
symsymobject.
systemsystemobject.
tabletableobject.
texttextobject.
valmapvalmapobject.
varvarestimationobject.
vectorvectorobject.
ObjectContainer,Data,andFileCommands
ccopycopyseriesfromDRIdatabase.
cfetchfetchseriesfromDRIdatabase.
clabeldisplayDRIseriesdescription.
closecloseobject,program,orworkfile.
copycopyobjectswithinandbetweenworkfiles,workfilepages,anddatabases.
dbopenorcreateadatabase.
dbcopymakecopyofadatabase.
dbcreatecreateanewdatabase.
dbdeletedeleteadatabase.
dbopenopenadatabase.
dbpackpackadatabase.
dbrebuildrebuildadatabase.
dbrenamerenameadatabase.
deletedeleteobjectsfromaworkfile.
driconvertconverttheentireDRIdatabasetoanEViewsdatabase.
expandexpandworkfilerange.
fetchfetchobjectsfromdatabasesordatabankfiles.
hconvertconvertanentireHaverAnalyticsdatabasetoanEViewsdatabase.
hfetchfetchseriesfromaHaverAnalyticsdatabase.
hlabelobtainlabelfromaHaverAnalyticsdatabase.
importimportsdatafromaforeignfileorapreviouslysavedworkfileintothecurrentdefaultworkfile.
loadloadaworkfile.
logclearclearthelogwindowcorrespondingtotheprogram.
logmodesetthelogsettingsofspecifiedmessagetypes.
logmsgaddalineoftexttotheprogramlog.
logsavesavetheprogramlogtoatextfile.
openopenaprogramortext(ASCII)file.
pageappendappendobservationstoworkfilepage.
pagecontractcontractworkfilepage.
pagecopycopycontentsofaworkfile.
pagecreatecreateaworkfilepage.
pagedeletedeleteaworkfilepage.
pageloadloadoneormorepagesintoaworkfilefromaworkfileoraforeigndatasource.
pagerefreshrefreshalllinksandauto-seriesintheactiveworkfilepage-primarilyusedtorefreshlinksthatuseexternaldatabasedata.
pagerenamerenameaworkfilepage.
pagesavesavepageintoaworkfileoraforeigndatasource.
pageselectmakespecifiedpageactive.
pagestackreshapetheworkfilepagebystackingobservations.
pagestructapplyaworkfilestructuretothepage.
pageunlinkbreaklinksinalllinkobjectsandauto-updatingseries(formulae)intheactiveworkfilepage.
pageunstackreshapetheworkfilepagebyunstackingobservationsintomultipleseries.
rangeresettheworkfilerange.
readimportdatafromaforeigndiskfileintoseries.
savesaveworkfiletodisk.
sortsorttheworkfile.
storestoreobjectsindatabaseanddatabankfiles.
unlinkbreaklinksandauto-updatingseries(formulae)inthespecifiedseriesobjects.
wfcloseclosetheactiveworkfile.
wfcreatecreateanewworkfile.
wfopenopenworkfileorforeignsourcedataasaworkfile.
wfrefreshrefreshalllinksandauto-seriesintheactiveworkfile-primarilyusedtorefreshlinksthatuseexternaldatabasedata.
wfsavesaveworkfiletodiskasaworkfileoraforeigndatasource.
wfselectchangeactiveworkfilepage.
wfstatsdisplaytheworkfilestatisticsandsummaryview.
wfunlinkbreaklinksinalllinkobjectsandauto-updatingseries(formulae)intheactiveworkfile.
wfuseactivateaworkfile.
workfilecreateorchangeactiveworkfile.
writewriteseriestoadiskfile.
ObjectUtilityCommands
closeclosewindowofanobject,program,orworkfile.
copycopyobjects.
deletedeleteobjects.
renamerenameobject.
ObjectAssignmentCommands
dataenterdatafromkeyboard.
frmlassignformulaforauto-updatingtoanumericoralphaseriesobject.
genrcreatenumericoralphaseriesobject.
rndintassignrandomintegervaluestoobject.
rndseedsetrandomnumbergeneratorseed.
GraphCreationCommands
Graphcreationisdiscussedindetailin"GraphCreationCommands".
areaareagraph.
bandareabandgraph.
barbargraph.
boxplotboxplotgraph.
distplotdistributiongraph.
dotdotplotgraph.
errbarerrorbargraph.
hilohigh-low(-open-close)graph.
lineline-symbolgraph.
piepiechart.
qqplotquantile-quantilegraph.
scatscatterplot.
scatmatmatrixofallpairwisescatterplots.
scatpairscatterplotpairsgraph.
seasplotseasonallinegraph.
spikespikegraph.
xyareaXYareagraph.
xybarXYbargraph.
xylineXYlinegraph.
xypairXYpairsgraph.
TableCommands
setcellformatandfillinatablecell.
setcolwidthsetwidthofatablecolumn.
setlineplaceahorizontallineintable.
tabplaceinsertatableintoanothertable.
Notethatwiththeexceptionoftabplace,thesecommandsaresupportedprimarilyforbackwardcompatibility.Thereisamoreextensivesetoftableprocsforworkingwithandcustomizingtables.See"TableProcs".
ProgrammingCommands
execexecuteaprogram.