Hi, in an upcoming engagement I will need to use T-SQL instead of SAS and PROC SQL. Has anyone used T-SQL before? If so, are there any important differences in syntax that might be of value to know beforehand. Also, is there a resource that I can refer to that might show me how a certain query might be written differently in T-SQL compared to PROC SQL.
The T-SQL will be used primarily for querying and reporting purposes rather than database administration purposes.
T-SQL is Microsoft so there's tons of documentation and examples out on the web.
Biggest difference - look into Windowing function
Thanks @Reeza. Will look into the difference in the Windowing function.
It's not so much difference as something SAS doesn't have.
And Pivot? Or is that Oracle? Look into how they do processing over groups basically, besides group by.
Thank you for your input @LinusH. This is great I'm sure I will learn more along the way. One difference I chanced upon recently was with the AS keyword while assigning Aliases.
The AS keyword is recommended but can be omitted while assigning an Alias in T-SQL.
Not having the AS keyword while assigning an Alias in PROC SQL causes an error.
Another minor difference is while eliminating duplicate rows:
The DISTINCT keyword is common between T-SQL and PROC SQL. PROC SQL also has an alternative, the UNIQUE keyword. This, I believe, isn't available in T-SQL.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.