Let's call it validname.
So, mvalid says that 'field no 1' is invalid...but validname('field no 1') would return 'field_no_1'.
Can you provide some context as to where this is needed.
Are you suggesting something like:
If mvalid(somevar) ne 1 then validname(somevar);
That would assign a valid member name value to variable somevar?
Without you knowing what the result could be?
What would you expect to happen if the resolved new name matches one that already exists?
The translate function might accomplish what you need barring the check on any existing names:
x='*field no 10';
When converting Access or Excel field names to SAS. The idea is to avoid 'field no 10'n nonsense. I like your solution, though, except it doesn't handle periods or commas or multiple spaces or names starting with numbers. I guess I'll come up with something that combines COMPBL and COMPRESS functions.
Here's an example of some of the junk columns I have to deal with:
Region . (1 - 11)County Name Within Region:Recipient's Medicaid IDRecipient Last NameRecipient First NameAge of EnrolleeDate of Grievance(1 - 13) Type of GrievanceDate of Apeal(1 - 6) Appeal ActionEPSDT RelatedDate of Disposition(1 - 15) Type of DispositionDisposition Status R=Resolved P=PendingDate of Disposition SentExpedited Request Y=yes N=NoFile Type:GM=Griev MMA_AM=Appeal MMAOriginator 1=Enrollee 2 = Provider
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.