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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1035 views
  • 0 likes
  • 2 in conversation