Hi everyone,
I am trying to group together a promotional index that includes data like "10% off", "20% Off" etc.
data work.jk_promotions;
set work.jk_promo_index;
if outlet_desc like '%10% OFF%' then promo='10% OFF';
else if outlet_desc like '20% OFF' then promo='20% OFF';
else if outlet_desc like '25% OFF' then promo='25% OFF';
else if outlet_desc like '30% OFF' then promo='30% OFF';
else if outlet_desc like '40% OFF' then promo='40% OFF';
else if outlet_desc like '50% OFF' then promo='50% OFF';
else if outlet_desc like 'BANK' then promo='BANK HOLIDAY';
else if outlet_desc like 'BABY' then promo='BABY & TODDLER';
else if outlet_desc like 'APPLE' OR outlet_desc like 'MAC' then promo='APPLE';
else if outlet_desc like 'END OF SEASON'
OR outlet_desc like 'EOS'
OR outlet_desc like 'E&S' then promo='END OF SEASON';
else if outlet_desc like 'MID' then promo='MID SEASON';
else if outlet_desc like 'BACK TO SCHOOL' then promo='BACK TO SCHOOL';
else if outlet_desc like 'BIG EVENT' then promo='BIG EVENT';
else if outlet_desc like 'BLACK FRIDAY' OR outlet_desc like 'BF' then promo='BLACK FRIDAY';
else if outlet_desc like 'BLACK TAG' then promo='BLACK TAG';
else if outlet_desc like 'CYBER WEEK' then promo='CYBER WEEK';
else if outlet_desc like 'CHARACTER' then promo='CHARACTER';
else if outlet_desc like 'WEEKEND' then promo='WEEKEND';
else if outlet_desc like 'TOYS' then promo='TOYS';
else if outlet_desc like 'EASTER' then promo='EASTER';
run;
This is what I have so far.
The error that I am getting is:
ERROR 388-185: Expecting an arithmetic operator.
Any assistance would be appreciated, thanks!
Is LIKE allowed inside an IF statement within a data step?
Isn't it for PROC SQL? The Error must be underlined for the LIKE in your log, where it is actually expecting an arithmetic operator and that's I think is the error log about. I might be wrong, ready to be corrected.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.