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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -