|
clear
input ///
str6 x1 str5 x2 str6 x3 x4
1 2 3 4
"N/A" 2 3 4
1 X 3 4
1 2 ? 4
1 2 3 4
end
list
destring _all,replace force
des
list
********************
*结果
. clear
.
. input ///
> str6 x1 str5 x2 str6 x3 x4
x1 x2 x3 x4
1. 1 2 3 4
2. "N/A" 2 3 4
3. 1 X 3 4
4. 1 2 ? 4
5. 1 2 3 4
6. end
.
. list
+--------------------+
| x1 x2 x3 x4 |
|--------------------|
1. | 1 2 3 4 |
2. | N/A 2 3 4 |
3. | 1 X 3 4 |
4. | 1 2 ? 4 |
5. | 1 2 3 4 |
+--------------------+
.
. destring _all,replace force
x1 contains nonnumeric characters; replaced as byte
(1 missing value generated)
x2 contains nonnumeric characters; replaced as byte
(1 missing value generated)
x3 contains nonnumeric characters; replaced as byte
(1 missing value generated)
x4 already numeric; no replace
.
. des
Contains data
obs: 5
vars: 4
size: 35
-------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------------------------------------
x1 byte %10.0g
x2 byte %10.0g
x3 byte %10.0g
x4 float %9.0g
-------------------------------------------------------------------------------------------------------------
Sorted by:
Note: dataset has changed since last saved
. list
+-------------------+
| x1 x2 x3 x4 |
|-------------------|
1. | 1 2 3 4 |
2. | . 2 3 4 |
3. | 1 . 3 4 |
4. | 1 2 . 4 |
5. | 1 2 3 4 |
+-------------------+
.
end of do-file
|