I have a numeric variable with values of varying lengths. I would like to cut all but the first two digits of each value (each observation has a value of at least two digits). This is likely very simple, but I can't find the right command. See my data below.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long indnaics_num 622 5413 443142 23 812112 622 6212 6111 7220 7220 5614 22110 8131 42490 7211 7211 56173 3360 56173 6210 5411 6244 481 622 6230 9200 8131 9280 9280 23 622 6241 44410 8131 7130 6231 23 6212 3221 4451 23 5613 310 622 7220 23 23 51110 7220 447 5170 6214 61101 6211 61103 5202 812112 7220 4481 5170 5413 8123 6231 339900 7220 23 6230 7220 220 220 622 6111 923 9201 3364101 5170 8129 4231 5220 7220 3231 23 6230 5122 7130 622 22110 6214 54190 8131 622 337 33330 622 56173 6111 811192 9280 6111 3360 end
0 Response to Cutting all but the first two digits of a numeric variable of varying length
Post a Comment