good day
is there any function can count the blank from name string
| FACEBK AABMSW FBMEADS IRL |
like there are 3 blanks over the name string
i also do some data cleansing on this record and the result is FACEBKAAB
can i using that cleansing result and scan/crosscheck the original record and show below result?
because i did the compress on my cleaned record and i wanted to keep that blank in this attempt of crosscheck
FACEBK AAB
so that i can know how well is my cleansing.
thanks in advance
Harry
Character strings offer huge numbers of variations: trailing blanks (that should presumably not be counted), multiple blanks between words (that presumably should be counted) to name a few. I would try it differently:
data want;
set have;
n_blanks = lengthn(var) - lengthn(compress(var));
run;
data w;
str='FACEBK AABMSW FBMEADS IRL';
count=countc(str,' ');
run;
/*Or you could use S modifier in the same COUNTC function*/
data w;
str='FACEBK AABMSW FBMEADS IRL kjh';
count=countc(str,,'s');
run;
Character strings offer huge numbers of variations: trailing blanks (that should presumably not be counted), multiple blanks between words (that presumably should be counted) to name a few. I would try it differently:
data want;
set have;
n_blanks = lengthn(var) - lengthn(compress(var));
run;
thank you all for helping
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.