Hello,
Reading someone else's code, I have run into for the first time the expression "replace var = .c", instead of "replace var = .". At first, I assumed this was a mistake, but running the code myself, it works. My question is thus, what exactly does this do, and why can't I find any reference to it online or in the help files?
Running this, yields the following:
Thus, one purpose seems to be to differentiate missing values already in the data from those replaced by us. Is there any other purpose?
Thanks,
Best,
Hélder
Reading someone else's code, I have run into for the first time the expression "replace var = .c", instead of "replace var = .". At first, I assumed this was a mistake, but running the code myself, it works. My question is thus, what exactly does this do, and why can't I find any reference to it online or in the help files?
Code:
sysuse auto, clear tab rep78, miss replace rep78 = .c if rep78 == 5 tab rep78, miss
. sysuse auto, clear
(1978 automobile data)
r; t=0.00 9:26:42
. tab rep78, miss
Repair |
record 1978 | Freq. Percent Cum.
------------+-----------------------------------
1 | 2 2.70 2.70
2 | 8 10.81 13.51
3 | 30 40.54 54.05
4 | 18 24.32 78.38
5 | 11 14.86 93.24
. | 5 6.76 100.00
------------+-----------------------------------
Total | 74 100.00
r; t=0.00 9:26:42
. replace rep78 = .c if rep78 == 5
(11 real changes made, 11 to missing)
r; t=0.00 9:26:42
. tab rep78, miss
Repair |
record 1978 | Freq. Percent Cum.
------------+-----------------------------------
1 | 2 2.70 2.70
2 | 8 10.81 13.51
3 | 30 40.54 54.05
4 | 18 24.32 78.38
. | 5 6.76 85.14
.c | 11 14.86 100.00
------------+-----------------------------------
Total | 74 100.00
r; t=0.00 9:26:42
.
end of do-file
(1978 automobile data)
r; t=0.00 9:26:42
. tab rep78, miss
Repair |
record 1978 | Freq. Percent Cum.
------------+-----------------------------------
1 | 2 2.70 2.70
2 | 8 10.81 13.51
3 | 30 40.54 54.05
4 | 18 24.32 78.38
5 | 11 14.86 93.24
. | 5 6.76 100.00
------------+-----------------------------------
Total | 74 100.00
r; t=0.00 9:26:42
. replace rep78 = .c if rep78 == 5
(11 real changes made, 11 to missing)
r; t=0.00 9:26:42
. tab rep78, miss
Repair |
record 1978 | Freq. Percent Cum.
------------+-----------------------------------
1 | 2 2.70 2.70
2 | 8 10.81 13.51
3 | 30 40.54 54.05
4 | 18 24.32 78.38
. | 5 6.76 85.14
.c | 11 14.86 100.00
------------+-----------------------------------
Total | 74 100.00
r; t=0.00 9:26:42
.
end of do-file
Thanks,
Best,
Hélder
Comment