基本命令、蒲丰投针与随机数生成

上传人:我** 文档编号:117887199 上传时间:2019-12-11 格式:PPT 页数:125 大小:548KB
返回 下载 相关 举报
基本命令、蒲丰投针与随机数生成_第1页
第1页 / 共125页
基本命令、蒲丰投针与随机数生成_第2页
第2页 / 共125页
基本命令、蒲丰投针与随机数生成_第3页
第3页 / 共125页
基本命令、蒲丰投针与随机数生成_第4页
第4页 / 共125页
基本命令、蒲丰投针与随机数生成_第5页
第5页 / 共125页
点击查看更多>>
资源描述

《基本命令、蒲丰投针与随机数生成》由会员分享,可在线阅读,更多相关《基本命令、蒲丰投针与随机数生成(125页珍藏版)》请在金锄头文库上搜索。

1、COPY RIGHT: DR. CHUNTAO LI leechtcn 1 帮助 Help 系统 Stata的每一个命令都有一个对应的帮助文件 help help help regress help summarize help function help tabulate help generate help matrix 帮助系统 系统帮助 help 网络帮助 findit google 专家帮助 majordomohsphsun2.harvard.edu /subscribe statlist statlisthsphsun2.harvard.edu COPY RIGHT: DR. CH

2、UNTAO LI leechtcn 3 有用的网站 B http:/www.ats.ucla.edu/stat/stata/ DOS命令 mkdir dir cd erase type copy COPY RIGHT: DR. CHUNTAO LI leechtcn 4 copy 命令 copy orig.dta newcopy.dta copy my document copy of document“ copy .mydirdoc.txt documentdoc.tex copy d:simple.dta copy d:simple.txt, text COPY RIGHT: DR. CH

3、UNTAO LI leechtcn 5 常用命令 order codebook compare inspect browse dedit sort which COPY RIGHT: DR. CHUNTAO LI leechtcn 6 compare webuse fullauto, clear compare rep78 rep77 COPY RIGHT: DR. CHUNTAO LI leechtcn 7 cf sysuse auto drop gear_ratio replace mpg = 20 in 1/2 replace rep78 = 6 in 3 save mycf sysus

4、e auto cf _all using mycf COPY RIGHT: DR. CHUNTAO LI leechtcn 8 常用命令 list drop keep generate replace rename egen COPY RIGHT: DR. CHUNTAO LI leechtcn 9 常用命令 输入数据 input /直接在数据编辑窗口输入 读入数据 use、insheet using 查看工作路径 cd ; dir 常用命令 保存、输出数据 save、outsheet using 查看数据 list (in/if),table/display ;browse/edit(in/

5、if) 更替数据 replace 常用命令 Stata运算符号 +,-,*,/,, sqrt(), exp(), ln(), log(), log10() , max(), min(), mod(), int(), round() 计算器 display 常用命令 生成新变量 generate generate type newvar=exp if in .sysuse auto .gen p2=sqrt(price) .gen n_v1=price*mpg .replace p2=int(p2) .gen n_v2=price*length if foreign=1 . by foreign

6、: generate n_v3=gear_ratio if _n=_N 常用命令 修改变量名 rename sysuse auto rename make car_make rename price pi rename mpg car_mpg save D:new_auto.dta, replace 常用命令 复制文件 copy cd D: dir copy auto.dta copy_auto.dta dir copy temp.txt copy_temp.txt copy temp.do copy_temp.do dir 常用命令 显示文件内容 type type stk_price.tx

7、t type temp.txt 删除数据(从文件夹)erase erase newcopy.dta erase stk_price.dta 常用命令 简单的查看整体数据统计性质 describe; summarize clear sysuse auto des sum by foreign: sum by foreign: sum price mpg rep78, detail 常用命令 变量标签 label clear all sysuse auto des label data 1978汽车调查数据 des label data *1978汽车调查数据 des label data des

8、 常用命令 label variable mpg mile age label variable foreign “car_type“ label list label dir label list label drop origin label define ori 0 Domestic 1 Foreign label list 常用命令 label list ori label copy ori orig label define orig 2 ,add label define orig 2 dont know, modify replace foreign=2 if mod(_n,10

9、)=4 label values foreign orig label save orig using mylabel type mylabel.do 常用命令 label drop orig label dir do mylabel label dir 常用命令 删除变量 drop/keep,(in/if) clear all sysuse auto drop make drop in 4 drop if foreign=1 keep price mpg rep78 headroom trunk turn displacement gear_ratio foreign 常用命令 keep i

10、n 5/54 keep if price7000 删除数据 clear use stk_price mat A=mat(1,2,32,3,4) clear mat l A clear all ; mat l A 常用命令 排列数据 sort、gsort clear all sysuse auto des sort price list make price in 1/10 list make price in -10/-1 list foreign price in -10/-1 gsort -price list make price in 1/10 常用命令 数个数 count count

11、 count if rep78=. count if price6165 count if foreign=0 常用命令 计算变量平均数 ameans;mean, over( ) ameans price ameans price, add(1000) level(99) mean price mpg headroom trunk mean price mpg headroom, over(foreign) mean price mpg headroom, over(rep78) sort rep78 by rep78: ameans price mpg headroom 常用命令 统计性质列

12、表 tabstat;table; tabulate table rep78 table rep78, content(n mpg mean mpg sd mpg median mpg) table rep78, content(n mpg mean price) table rep78 foreign table foreign rep78,content(mean mpg) row col 常用命令 tabstat mpg tabstat mpg, stat(n mean sd) tabstat price mpg headroom trunk tabstat price mpg headr

13、oom trunk,stat(n mean sd) tabstat price mpg headroom trunk,stat(n mean sd min max) sort foreign 常用命令 by foreign:tabstat price mpg tabstat price mpg, by(foreign) tabstat price mpg, by(foreign) nototal tabstat price mpg, by(rep78) tabulate rep78 tabulate rep78, sort tab rep78, gen(rep) 常用命令 des tab rep78 foreign 改变变量排列顺序 order keep make price mpg rep78 order price rep78 make mpg 常用命令 另一个重要的生成变量命令 egen 改变数据类型 format 常用命令 stata 保存的数据类型 byte int long float double str# 数据显示格式 %g %gc %f %fc %s %t %tc date/time;%td date;%tw week %tm month;%tq quarter;%th half-

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号