stata基本使用.ppt
《stata基本使用.ppt》由会员分享,可在线阅读,更多相关《stata基本使用.ppt(26页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、STATA 10 Yuan ChangIntroductionReviewVariablesCommandResultData editorDo-fileHelpContentsData managementGraphsSummarizingLiner RegressionprogrammingData managementCreating and using a databaseGenerating and replacing variablesDummy variablesCreating random data and random samplesCreating and using a
2、 databaseCreating a dataUse data editorInsheet ex.insheet using c:stata10 britishmarket.txt (excel save as.txt )save C:Stata10sample.dta outsheet using c:stata10sample.outUsing a dataFile-open(ctrl+o)use C:Stata10auto.dta,clearGenerating and replacing variablesGenerate(gen)and replace (use help:sear
3、ch generate)generate type newvar:lblname=exp if in replace oldvar=exp if in,nopromote ex.gen lprice=price if price=5000 replace lprice=0 if lprice=.in 9 gen num=_nEgen (more functions are available)(functions in STATA 18 ccb page 47-50)Dummy variablesgen ex.gen foreign1=0 replace foreign1=1 if forei
4、gn=“foreign”tabulate ex.tabulate foreign,generate(foreign)list foreign foreign1 foreign2 Creating random data and random samplesuniform()ex.set obs 74 gen randnum=uniform()gen z=invnormal(uniform()samples sample#if in,count by()*without replacement bsample exp if in,options *with replacement ex.samp
5、le 33,count by(foreign)foreign和demastic各抽33 sample 50 if foreign1=1 抽样50%bsample 33,strata(foreign)foreign和demastic各抽33 bsample 3,cluster(headroom)抽三组headroom相同的组backGraphsScatterHistogramLinePie chart and Bar chartScatter twoway scatter varlist if in weight,optionsex.twoway scatter price mpg 散点图 tw
6、oway scatter price mpg,by(foreign)Histogram histogram varname if in weight,continuous_opts|discrete_opts optionsex.hist length,frequency 直方图 hist length,start(140)width(5)norm 加正态曲线line twoway line varlist if in,options 折线图 ex.sort mpg 顺序排列 twoway line price weight mpg if foreign1=0Pie chart and Bar
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- stata 基本 使用
限制150内