BookmarkSubscribeRSS Feed



Let's call it validname.


So, mvalid says that 'field no 1' is invalid...but validname('field no 1') would return 'field_no_1'.

Super User

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:

data example;
   x='*field no 10';
   x=translate(x,'__________________________',' <>?/:;[]{}\|+=-)(*&^%$#@!');
Rhodochrosite | Level 12

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 ID
Recipient Last Name
Recipient First Name
Age  of Enrollee
Date of  Grievance
(1 - 13) Type of  Grievance
Date of Apeal
(1 - 6) Appeal Action
EPSDT  Related
Date of Disposition
(1 - 15) Type of Disposition
Disposition Status         R=Resolved  P=Pending
Date of Disposition Sent
Expedited Request   Y=yes  N=No
File Type:GM=Griev MMA_AM=Appeal MMA
Originator   1=Enrollee 2 = Provider