BookmarkSubscribeRSS Feed
WAL83
Obsidian | Level 7
I have a dataset that has one field, "progNote" with max size=32767. This variable contains some information I am interested in. I want to extract a portion of the text in this variable and place into a new variable. The begining of the text I want to extract is always the same which is "MILITARY HISTORY:". I want to extract text starting from the M in Military to 300 characters after for all records. Is there a way to do this in SAS. Thanks.
2 REPLIES 2
Olivier
Pyrite | Level 9
Something like :
[pre]
LENGTH excerpt $ 300 ;
start = INDEXW(progNote, "MILITARY HISTORY") ;
IF start > 0 THEN excerpt = SUBSTR(progNote, start) ;
[/pre]
may solve your problem.

Olivier
WAL83
Obsidian | Level 7
Sorry I haven't gotten back sooner. I acutally solved my problem using VBA and Access. Thanks.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 2 replies
  • 1350 views
  • 0 likes
  • 2 in conversation