I have a data set that goes like this:
DATA hogwarts;
INFILE DATALINES delimiter="," dsd;
LENGTH Index Wizards $ 255;
INPUT Index Wizards $ Points;
DATALINES;
1,'Harry Potter Ron Weasley',100
2,'Hermione Granger Harry Potter',200
3,'Ron Weasley',300
;
RUN;
In other words it look like this:
Index | Wizards | Points |
---|---|---|
1 | Harry Potter Ron Weasley | 100 |
2 | Hermione Granger Harry Potter | 200 |
3 | Ron Weasley | 300 |
I need to spot regex patterns stored in a wizards
data set that looks like this:
Name |
---|
Harry Potter |
Ron Weasley |
Hermione Granger |
You can generate it with:
DATA wizards;
INPUT Name $64.;
DATALINES;
Harry Potter
Ron Weasley
Hermione Granger
;
RUN
And output a want
data set that looks like this:
Index|Wizards|Points|Wizard1|Wizard2
-|-|-|-|-
1|Harry Potter Ron Weasley|100|Harry Potter|Ron Weasley
2|Hermione Granger Harry Potter|200|Hermione Granger|Harry Potter
3|Ron Weasley|300|Ron Weasley|.
The result in Wizard1
,Wizard2
…WizardN
needs to be positional: e.g. at line 2 of hogwarts
Hermione Granger pattern appears first in the Wizards
column then appears Harry Potter so the value of Wizard1
in want
needs to be Hermione Granger.
Plus the number of Wizard1-WizardN
column is not predetermined.
Does someone have a clue?
Many thanks in advance,