Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65561

Replacing observations with missing values

$
0
0
Dear all,

Suppose i have the following data:

Code:
id          var5     var1   var3
0             5        5      5
50           10       10     10
55           20       20     20
78           30       30     30
98           40       40     40
143          50       50     50
167          60       60     60
184          70       70     70
192          80       80     80
203          90       90     90
219          100     100    100
238          110     110    110
246          120     120    120
252          130     130    130
269          140     140    140
280          150     150    150
I am trying to create a loop that will replace certain observations in vars 5-3 (in that order) with missing values based on values of id (0, 167, 246). However, so far i have been unsuccessful. The data should look like this:

Code:
id               var5       var1       var3
0                 5           .           .  
50               10           .           .
55               20           .           .
78               30           .           .
98               40           .           .
143              50           .           .
167              .           60           .
184              .           70           .  
192              .           80           .
203              .           90           .  
219              .          100           .  
238              .          110           .
246              .             .        120
252              .             .        130
269              .             .        140
280              .             .        150
290              .             .        160
305              .             .        170
Any ideas how i might be able to achieve that?

Thank you.

Viewing all articles
Browse latest Browse all 65561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>