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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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