Well, its a bit tricky in code, an example below. Also you run the risk of a few various, extra spaces, dots in words (for example etc., or e.g.). I would prefer to proces the text at source rather than at receipt.
string="Officials said they had no choice after more than 13,000 people entered the country since Hungary fenced off its border with Serbia earlier this week. Many have been taken by bus to reception centres but some say they plan to walk to neighbouring Slovenia? Huge numbers of people heading north from the Mediterranean have created a political crisis in the European Union? Croatian officials said roads leading to the border crossings had also been shut! The crossing on the main road linking Belgrade and Zagreb - at Bajakovo - appeared to be the only one left open";
string="Officials said they had no choice after more than 13,000 people entered the country since Hungary fenced off its border with Serbia earlier this week.";
string="Many have been taken by bus to reception centres but some say they plan to walk to neighbouring Slovenia?";
length sentance $2000;
do i=1 to length(string);
if substr(string,i,1) in ('.','?','!') or i=length(string) then do;
I would think you could use the SCAN function, where delimiters are period, exclamation and question mark, to extract each sentence one by one. Of course, as noted, this fails if there is a period within a sentence, like "Mr. Jones came home."
Yes, that is exactly the same as I posted. Firstly the code is unreadable, need to put things on different lines, use indetation. There are two main differences, firstly, he has assumed that there will be no more than 6 strings per sentance. This may or may not work. Secondly, he uses an array of blocks of text up to a maximum of 6. This may be fine, but I tend to prefer a normalised strcuture (data goes down rather than across) as the code is simplified.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.