Harlan Nelson
Harlan Nelson

Reputation: 1502

Super simple SAS prxposn example needed

I am looking for a super simple prxposn example that works. Something like this, only I want code that extracts text.

data test;
    re = prxparse('/(hello)/');
    extract = prxposn(re,1,'hello');
    output;
run;

results

re  extract
1   

Upvotes: 2

Views: 731

Answers (1)

Harlan Nelson
Harlan Nelson

Reputation: 1502

data test;
    re = prxparse('/(hello)/');
    if prxmatch(re,'hello') then extract = prxposn(re,1,'hello');
    output;
run;

The call to prxmatch is required for prxposn to work.

result

re  extract
1   hello

Upvotes: 4

Related Questions