PROC SQL vs. T-SQL

Accepted Solution Solved
Reply
Contributor
Posts: 49
Accepted Solution

PROC SQL vs. T-SQL

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.


Accepted Solutions
Solution
‎08-11-2016 12:44 PM
Super User
Posts: 5,388

Re: PROC SQL vs. T-SQL

Except from the obvious SAS specifics like functions and formats, there two differences I think is worth mentioning :
- no support for the "remerging summary statics with original data". You need the spicy join the aggregation results back.
- no support for the calculated key word. You need to repeat any formula wich result you wish to use more than once in the same query.
Data never sleeps

View solution in original post


All Replies
Super User
Posts: 19,167

Re: PROC SQL vs. T-SQL

T-SQL is Microsoft so there's tons of documentation and examples out on the web. 

 

Biggest difference - look into Windowing function 

Contributor
Posts: 49

Re: PROC SQL vs. T-SQL

Thanks @Reeza. Will look into the difference in the Windowing function.

Super User
Posts: 19,167

Re: PROC SQL vs. T-SQL

It's not so much difference as something SAS doesn't have. 

 

 

Super User
Posts: 19,167

Re: PROC SQL vs. T-SQL

And Pivot? Or is that Oracle? Look into how they do processing over groups basically, besides group by. 

Solution
‎08-11-2016 12:44 PM
Super User
Posts: 5,388

Re: PROC SQL vs. T-SQL

Except from the obvious SAS specifics like functions and formats, there two differences I think is worth mentioning :
- no support for the "remerging summary statics with original data". You need the spicy join the aggregation results back.
- no support for the calculated key word. You need to repeat any formula wich result you wish to use more than once in the same query.
Data never sleeps
Contributor
Posts: 49

Re: PROC SQL vs. T-SQL

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.

Contributor
Posts: 49

Re: PROC SQL vs. T-SQL

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 776 views
  • 2 likes
  • 3 in conversation