BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
librasonali
Quartz | Level 8
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 ! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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;

View solution in original post

1 REPLY 1
Ksharp
Super User
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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 723 views
  • 3 likes
  • 2 in conversation