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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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