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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.