I salute you for letting him know how important this is! And good work forcing it-kids often would rather not do stuff, and it's our job to teach them and enforce it. I hope you find things in these posts that you haven't tried, and I hope I'm not telling you stuff you've tried already.
If this was my son, I would sit him down (I'm sure you've done this) sometime when the issue isn't happening and explain to him WHY it is important to be friendly to his elders. Find some heroic war stories etc about people that age and why they are very important, explain about their feelings being acknowledged by younger generations and how many of them have lost friends and like to feel appreciated-whatever, you choose what your son might understand. I tell my daughter stories of hardship form my grandmother's life, and it has made her respect and love grandma sand other older people even more. Tell your son part of being a good and respectful gentleman is politeness to elders, and his life will be much better if he is nice than if he is not.
Then make your expectation of what he should do in a social situation very clear, like "I want you to smile and say hello to your elder when we are out. I will touch your shoulder if I have to to remind you."
Then make his consequence known before hand, again, very clear, "If we are saying hello to someone, and you do not say hello politely, and I have touched your shoulder, this is what will happen when we get home, back to the car, etc." And FOLLOW THROUGH.
Remind him before hand every time you're getting out of the car to enter a mall etc. That way you're not caught off guard where he's suddenly ignoring and you have no way to signal him and enforce in the moment. It seems so repetitive, but if it's important to you, you have to treat it as a serious rule.
Give him huge praise when he does it on his own. Don't bribe with rewards, but you could do something like, "You've been such a gentleman lately, let's go do such and such together"....
Get a hold of some old movies, westerns, etc, where the kids said yes sir and yes ma'am and respected their elders for him to watch. he doesn't have a lot of good examples these days. Unfortunately, you do have to force it until it becomes natural. Good work, good luck! Not eno0ugh parents enforce rules or "force" manners, which is why kids today are terribly rude.