BookmarkSubscribeRSS Feed
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Using SAS 9.4

 

I am trying to use the wildcard while writing a format to avoid spelling out each item. Am I using the wildcard incorrectly? Any thoughts? Thank you

 

 

 

I have attached my code as screenshot as well ( I have run at the bottom it is just not captured)

PROC FORMAT;
VALUE $RACE_DESC 'AMERICAN INDIAN:' = 'AMERICAN INDIAN/ALASKAN NATIVE'
'JAPANESE','FILIPINO','VIETNAMESE','OTHER ASIAN','ASIAN INDIAN:' = 'ASIAN'
'WHITE' = 'CAUCASIAN'
'BLACK' = 'AFRICAN AMERICAN'
'OTHER' = 'OTHER RACE'
'UNKNOWN' = 'UNKNOWN RACE';
VALUE $ETHNICITY_DESC 'MEXICAN','SPANISH:','SOUTH:' = 'HISPANIC/LATINO'
'NON-SPANISH' = 'NON-HISPANIC/LATINO'
'UNKNOWN:' = 'UNKNOWN ETHNICITY';
VALUE $TUMOR_STAGE '0' = 'STAGE 0'
'IA','IB' = 'STAGE I'
'IIA','IIB' = 'STAGE II'
'IIIA','IIIB','IIIC' = 'STAGE III'
'IV' = 'STAGE IV'
'NA','UNK' = 'UNKNOWN/NOT APPLICABLE';
value $PRIMARY_PAYER_DESC 'INSURANCE STATUS UNKNOWN','UNKNOWN 01','UNKNOWN 02' = 'UNKNOWN'
'NOT APPLICABLE' = 'NOT APPLICABLE'
'MEDICAID:' = 'MEDICAID'
'MEDICARE:' = 'MEDICARE'
'INSURANCE, NOS' = 'INSURANCE, NOS'
'MANAGED CARE PROVIDER, HMO, PPO','PRIVATE INSURANCE: FEE-FOR SERVICE' = 'PRIVATE INSURANCE'
'TRICARE' = 'SELF PAY/OTHER';

run;

 

1 REPLY 1
ballardw
Super User

Proc Format does not recognize any "wild card" character. The : you are using is used for variable name lists, not values.

 

It will accept ranges of values but don't expect good results with character values.

 

You might consider extracting the different values into a data set and using that data set to create a format.

Something like this might get you started:

proc sql;
   create table payer as
   select distinct Primary_payer 
   from yourdataset;
run;

data payerfmt;
   set payer;
   fmtname="$PRIMARY_PAYER_DESC";
   type='C';
   start=Primary_payer;
   if index(start,'UNKNOWN')>0 then Label='UNKNOWN';
   else    if index(start,'MEDICAID')>0 then Label='MEDICAID';
   else    if index(start,'MEDICARE')>0 then Label='MEDICARE';
   else if start in ('MANAGED CARE PROVIDER, HMO, PPO','PRIVATE INSURANCE: FEE-FOR SERVICE')
      then label = 'PRIVATE INSURANCE';
   else if start='TRICARE' then label = 'SELF PAY/OTHER';
   else label=start;
run;

proc format cntlin=payerfmt;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1795 views
  • 0 likes
  • 2 in conversation