BookmarkSubscribeRSS Feed
Nietzsche
Lapis Lazuli | Level 10

In the SAS Programming 1 course, the example used the standard UPCASE function within PROC SQL which I thought was a bit weird because there is already SQL UPPER function for that, so I tried it, and both worked.

So my question is that are some SQL and SAS syntax interchangeable within PROC SQL procedure? What about outside the PROC SQL procedure?

 

Ben_in_Canberra_0-1666210320502.png

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
1 REPLY 1
ballardw
Super User

SAS Proc SQL supports basic ANSI syntax. As is common in SQL, SAS also implements other functions, partially because those of us that learned SAS first really wanted to use the same function like Upcase . Not so much the other way around though. A very few SQL ideas such a "LIKE" and "Contains" "Between" and "Is null" that only apply to Where statements are available in data step but generally there are differences.

 

There are complications with a few commonly named functions such as MAX and MIN which relate to aggregates of single variables over multiple records in SQL or data step summary of multiple variables within an observation.

 

 

In general: do not expect an SQL function to work in a data step and if it does not generate an error it may not result in what you expect.

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

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 698 views
  • 2 likes
  • 2 in conversation