Big_Pete
06-29-2009, 03:41 PM
When using PRXPARSE, how do I make it ignore some characters?
For example I'm trying to change abbreviations of gram to that full word, but I need to make SAS ignore the 100 in "100g","100gm","100gr","100 g","100 gm", or "100 gr".
I tried
retain k;
k=prxparse('s/(?#\d{1,3})(\s)?(GR\s|GM\s|G\s)/ GRAM /');
call prxchange(k,-1,test_ordered);
drop k;
It worked in some parts but I also get unwanted results like "IG GRAM" when it should remain "IGG" or "BRAG GRAM" when it should stay "BRAGG". Words ending with g turns into gram, like "BURNIN GRAM" instead of "BURNING".
When I tried:
retain k;
k=prxparse('s/ (?#\D{0,15})(?#\d{1,3})(\s)?G(R|M|\s) / GRAM /');
call prxchange(k,-1,test_ordered);
drop k;
I works when there's a blank between a number and "G" like "100 g","100 gm", or "100 gr" but nothing else.
Do you have any suggestions on how to remedy all this?
For example I'm trying to change abbreviations of gram to that full word, but I need to make SAS ignore the 100 in "100g","100gm","100gr","100 g","100 gm", or "100 gr".
I tried
retain k;
k=prxparse('s/(?#\d{1,3})(\s)?(GR\s|GM\s|G\s)/ GRAM /');
call prxchange(k,-1,test_ordered);
drop k;
It worked in some parts but I also get unwanted results like "IG GRAM" when it should remain "IGG" or "BRAG GRAM" when it should stay "BRAGG". Words ending with g turns into gram, like "BURNIN GRAM" instead of "BURNING".
When I tried:
retain k;
k=prxparse('s/ (?#\D{0,15})(?#\d{1,3})(\s)?G(R|M|\s) / GRAM /');
call prxchange(k,-1,test_ordered);
drop k;
I works when there's a blank between a number and "G" like "100 g","100 gm", or "100 gr" but nothing else.
Do you have any suggestions on how to remedy all this?