data reg;
set oriontst.REGION;
if country =('CA' , 'AU') then
do;
discount=0.10;
discount_type='required';
region='north_america';
end;
else if country ='OTHERS' then
do;
discount=0.05;
discount_type='optional';
region NE 'north_america';
end;
run;
My errors:
use IN operator
if country IN ('CA' , 'AU')
I think that's because
region NE 'north_america'; /*wrong assignment*/
is wrong in your else clause
else if country ='OTHERS' then
do;
discount=0.05;
discount_type='optional';
region NE 'north_america'; Wrong
end;
ok then what is the correct code .
see in the attachment(task) below.
Correction:
region = 'NOT north_america';
@asundha wrote:
If I use in also
I'm getting error like this
Statement is not valid or it is used out of order
The log points you to invalid code, and see my previous post.
if country =('CA' , 'AU') then do;
This is not proper syntax. You want
if country in ('CA','AU') then do;
In the future, please click on the {i} icon and paste your log into this window. We need to see your log, and we need to see it formatted properly for ease of reading, so please DO NOT SKIP THIS STEP.
Use the in operator:
if country in ('CA','AU') then do;
and
region NE 'north_america';
is not a valid SAS statement. What should it do?
PS see my footnotes for hints on posting code and logs ({i} and "little running man" buttons).
Sorry, we are really not here to do your homework. That question is very simple, and it is for you to do the programming on. If you have specific questions, come back with them, show what you have done and where you are stuck, and avoid using attachments - put text in the body of the post.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.