Stata基础命令03_use_save

use/save:Stata数据文件(.dta)的打开和保存
中南财经政法大学STATA协会学术组
2013年1月30日
1简介
在数据整理和分析中,大部分情况需要将现成的数据文件直接读入Stata中进行分析。.dta 数据文件是Stata的基本存储格式,也称为其扩展名,它的打开和保存我们使用use/save命令。谐波电流
2命令格式
usefilename [
,clear
]
.u
.use
3示例do-file
1
2
3
4
4运行结果
.use auto,clear/*清空内存数据,并打开Stata内置的auto.dta数据库*/
(1978Automobile Data)
(Continued on next page)2012年浙江高考数学
1其他格式的数据文件则不使用这两个命令,而是使用诸如insheet/outsheet,infile/oufile,infix等命令。
2在使用这个命令时,一般我们都会加上文件名。而如果不是覆盖保存,那么文件名更是不能省略。
1
wb193
.list/*将数据库陈列出来。这个数据库是美国1978年的汽车数*/ (output omitted)
.list make price mpg rep78headroom foreign/*只陈列这些变量*/
make price mpg rep78headroom foreign
1.AMC Concord4,099223
2.5Domestic
2.AMC Pacer4,749173
3.0Domestic
3.AMC Spirit3,79922.  3.0Domestic
4.Buick Century4,816203  4.5Domestic
5.Buick Electra7,827154  4.0Domestic
6.Buick LeSabre5,788183  4.0Domestic
7.Buick Opel4,45326.  3.0Domestic
8.Buick Regal5,189203  2.0Domestic
9.Buick Riviera10,372163  3.5Domestic
10.Buick Skylark4,082193  3.5Domestic
11.Cad.Deville11,385143  4.0Domestic
国模王真12.Cad.Eldorado14,500142  3.5Domestic
13.Cad.Seville15,906213  3.0Domestic
14.Chev.Chevette3,299293  2.5Domestic
15.Chev.Impala5,705164  4.0Domestic
16.Chev.Malibu4,504223  3.5Domestic
17.Chev.Monte Carlo5,104222  2.0Domestic
18.Chev.Monza3,667242  2.0Domestic
19.Chev.Nova3,955193  3.5Domestic
20.Dodge Colt3,984305  2.0Domestic
21.Dodge Diplomat4,010182  4.0Domestic
22.Dodge Magnum5,886162  4.0Domestic
23.Dodge St.Regis6,342172  4.5Domestic
24.Ford Fiesta4,389284  1.5Domestic
25.Ford Mustang4,187213  2.0Domestic
26.Linc.Continental11,497123  3.5Domestic
27.Linc.Mark V13,594123  2.5Domestic
28.Linc.Versailles13,466143  3.5Domestic
29.Merc.Bobcat3,829224  3.0Domestic
30.Merc.Cougar5,379144  3.5Domestic
31.Merc.Marquis6,165153  3.5Domestic
32.Merc.Monarch4,516183  3.0Domestic
33.Merc.XR-76,303144  3.0Domestic
34.Merc.Zephyr3,291203  3.5Domestic
35.Olds988,814214  4.0Domestic
36.Olds Cutl Supr5,172193  2.0Domestic
37.Olds Cutlass4,733193  4.5Domestic
补铁剂38.Olds Delta884,890184  4.0Domestic
39.Olds Omega4,181193  4.5Domestic
40.Olds Starfire4,195241  2.0Domestic
41.Olds Toronado10,371163  3.5Domestic
42.Plym.Arrow4,647283  2.0Domestic
43.Plym.Champ4,425345  2.5Domestic
44.Plym.Horizon4,482253  4.0Domestic
45.Plym.Sapporo6,48626.  1.5Domestic
46.Plym.Volare4,060182  5.0Domestic
47.Pont.Catalina5,798184  4.0Domestic
48.Pont.Firebird4,934181  1.5Domestic
49.Pont.Grand Prix5,222193  2.0Domestic
50.Pont.Le Mans4,723193  3.5Domestic
51.Pont.Phoenix4,42419.  3.5Domestic
52.Pont.Sunbird4,172242  2.0Domestic
53.Audi50009,690175  3.0Foreign
54.Audi Fox6,295233  2.5Foreign
55.BMW320i9,735254  2.5Foreign
56.Datsun2006,229234  1.5Foreign
57.Datsun2104,589355  2.0Foreign
58.Datsun5105,079244  2.5Foreign
59.Datsun8108,129214  2.5Foreign
60.Fiat Strada4,296213  2.5Foreign
61.Honda Accord5,799255  3.0Foreign
62.Honda Civic4,499284  2.5Foreign
63.Mazda GLC3,995304  3.5Foreign
64.Peugeot60412,99014.  3.5Foreign
65.Renault Le Car3,895263  3.0Foreign
66.Subaru3,798355  2.5Foreign
67.Toyota Celica5,899185  2.5Foreign
68.Toyota Corolla3,748315  3.0Foreign
69.Toyota Corona5,719185  2.0Foreign
70.VW Dasher7,140234  2.5Foreign
71.VW Diesel5,397415  3.0Foreign
72.VW Rabbit4,697254  3.0Foreign
73.VW Scirocco6,850254  2.0Foreign
迅雷在线点播74.Volvo26011,995175  2.5Foreign
.save auto1,replace/*另存为auto1.dta,如果已经有这个文件名的文件,那么覆盖保存*/ file auto1.dta saved

本文发布于:2024-09-20 19:51:42,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/614683.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:文件名   保存   使用
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议