data Extract; length Subjects $40; input Subjects $; cards; Archaeology Architecture and Built Environment Art and Design Classics and Ancient History English Language and Literature History Linguistics Modern Languages Performing Arts Philosophy
Theology, Divinity and Religious Studies ; run;
Hello,
Please find abv sample data . where output should be in a new field method2 be as below .
I am confused that do I have to use substring and scan ? but how that I am confused .
method2 |
Built Environment |
Design |
Ancient History |
Literature |
Religious Studies |
Thanks in advance ! 🙂
data Extract;
input Subjects $40.;
p=findw(Subjects,'and');
if p then want=substr(Subjects,p+4);
cards;
Archaeology
Architecture and Built Environment
Art and Design
Classics and Ancient History
English Language and Literature
History
Linguistics
Modern Languages
Performing Arts
Philosophy
Theology, Divinity and Religious Studies
;
run;
data Extract;
input Subjects $40.;
p=findw(Subjects,'and');
if p then want=substr(Subjects,p+4);
cards;
Archaeology
Architecture and Built Environment
Art and Design
Classics and Ancient History
English Language and Literature
History
Linguistics
Modern Languages
Performing Arts
Philosophy
Theology, Divinity and Religious Studies
;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.