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

converting vertical lines and slash

$
0
0
Hello all,
I am new to stata and am trying to create a new variables (Red_4, Red_11, Red_14 and Red_23 for example) by extracting observations (when observation = 4, 11, 14 or 23 for exaple) from a string variable (Blue) where those observations are separated by either vertical lines or slashs and can be preceeded or not by a zero (i.e 4 can be inputed as 4 or 04):

Blue Red_4 Red_11 Red_14 Red_23

1|02|23 . . . 23
02|04|11 4 11 . .
1/7/17 . . . .
04/09/23 4 . . 23
4|13|99 4 . . .

Many thanks in advance for any help


Viewing all articles
Browse latest Browse all 72769

Trending Articles



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