Remove last word from string in SAS? -
i have list of counties in dataset (calhoun county, el paso county, etc.) , return dataset has word 'county' stripped (calhoun, el paso, etc.) there easy way in sas? thank you!
call scan report position of nth word, can use substr. count=-1
end rather beginning.
data _null_; starting_word='el paso county'; count=-1; call scan(starting_word, count, pos, length); end_word=substr(starting_word,1,pos-2); *pos 'c' two; put end_word=; run;
Comments
Post a Comment