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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 1 reply
  • 194 views
  • 2 likes
  • 2 in conversation