BookmarkSubscribeRSS Feed
daniele_1306
Calcite | Level 5
I have a text field with the words delimited by; .
the number of words is fixed.
how can I extract all the words from the text field? 
ex:
Row 01: 299999;Pippo;45.89;Pluto;Sas
Row 02: 7777;George;4567.2;David;Enterprise

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16
May we know if you want words in separate columns/variables or in a single variable
Thanks,
Jag
PeterClemmensen
Tourmaline | Level 20

Do something like this and extract the values you consider a 'word'

 

data have;
length string $100;
string="299999;Pippo;45.89;Pluto;Sas";output;
string="7777;George;4567.2;David;Enterprise";output;
run;

data want;
   set have;
   do i=1 to countw(string, ';');
      word=scan(string, i, ';');
      output;
   end;
run;