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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.