BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tmetro
Calcite | Level 5

Please help.

I'm very new to SAS and trying to modify and existing proc. 

Right now the code looks like this. I want to add a second condition the where statement so that it's picking up where transtypedesc does not equal either 'change account' or 'void account'.  So I want to exclude change and void statuses.  I've tried a handful of attempts to add a second condition to the where statement and keep getting errors.

 

inner join acct.State as d on c.LobGuid = d.LobGuid

inner join acct.loc as e on d.StateGuid = e.StateGuid

inner join acct.locItemInfo as f on e.LocGuid = f.LocGuid

where BusinessUnitCd = 'AA'

and TransTypeDesc <> 'CHANGE ACCOUNT');

quit;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Try:

  where BusinessUnitCd = 'AA'

   and not upcase(TransTypeDesc) in ("CHANGE ACCOUNT","VOID ACCOUNT")

;

Your current statement ended with a parenthesis, but you didn't show all of your code, thus don't know if an additional parenthesis is needed.

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

Try:

  where BusinessUnitCd = 'AA'

   and not upcase(TransTypeDesc) in ("CHANGE ACCOUNT","VOID ACCOUNT")

;

Your current statement ended with a parenthesis, but you didn't show all of your code, thus don't know if an additional parenthesis is needed.

tmetro
Calcite | Level 5

Nice one sir.  You were correct.  There were two places where the end paren was not added when the original programmer added the 2nd condition.  I was so busy looking at the syntax and trying to work around that and I didn't notice the issue.  Unfortunately SAS EG didn't throw an error on the missing paren, like it would in VBA, it just got hung-up. 

art297
Opal | Level 21

That is twice today that people have called me "Sir".  I REALLY prefer "Art" these days.  But, glad to see that you have identified the problem.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

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
  • 3 replies
  • 1624 views
  • 0 likes
  • 2 in conversation