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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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