有两份表:表1是所有的研究样本的相关数据,表2是高新技术企业的。目的:把表2高新技术企业的在表1中标示出来,以便在表1中显示哪些是高新技术企业,然后要做分类检验。
我的想法:用merge命令,表2就两列,一列是股票代码,另一列是1(表示是高新技术企业)。可是,用merge命令说“using data not sorted”。
Contains data from d:\temp\auto1.dta
obs: 74 1978 Automobile Data
vars: 2 12 Mar 2014 15:55
size: 1,480 (_dta has notes)
-----------------------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------------------------------------------------
make str18 %-18s Make and Model
rep78 int %8.0g Repair Record 1978
----------------------------------------------------------------------------------------------------------------------------- Sorted by:
. use d:\temp\auto
(1978 Automobile Data)
. des
Contains data from d:\temp\auto.dta
obs: 74 1978 Automobile Data
vars: 12 12 Mar 2014 15:55
size: 3,182 (_dta has notes)
-----------------------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------------------------------------------------
make str18 %-18s Make and Model
price int %8.0gc Price
mpg int %8.0g Mileage (mpg)
rep78 int %8.0g Repair Record 1978
headroom float %6.1f Headroom (in.)
trunk int %8.0g Trunk space (cu. ft.)
weight int %8.0gc Weight (lbs.)
length int %8.0g Length (in.)
turn int %8.0g Turn Circle (ft.)
displacement int %8.0g Displacement (cu. in.)
gear_ratio float %6.2f Gear Ratio
foreign byte %8.0g origin Car type
-----------------------------------------------------------------------------------------------------------------------------
Sorted by: foreign
. drop rep78
. merge 1:1 make using D:\temp\auto1.dta
Result # of obs.
-----------------------------------------
not matched 0
matched 74 (_merge==3)
-----------------------------------------
. des
Contains data from d:\temp\auto.dta
obs: 74 1978 Automobile Data
vars: 13 12 Mar 2014 15:55
size: 3,256 (_dta has notes)
-----------------------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------------------------------------------------
make str18 %-18s Make and Model
price int %8.0gc Price
mpg int %8.0g Mileage (mpg)
headroom float %6.1f Headroom (in.)
trunk int %8.0g Trunk space (cu. ft.)
weight int %8.0gc Weight (lbs.)
length int %8.0g Length (in.)
turn int %8.0g Turn Circle (ft.)
displacement int %8.0g Displacement (cu. in.)
gear_ratio float %6.2f Gear Ratio
foreign byte %8.0g origin Car type
rep78 int %8.0g Repair Record 1978
_merge byte %23.0g _merge
-----------------------------------------------------------------------------------------------------------------------------
Sorted by: make
Note: dataset has changed since last saved