Since SAS isn't as reliant on UDFs as much as R is, I thought a thread on tips/useful gems hidden in SAS documentation/stuff you learned would be more appropriate than a thread on functions. So, share anything you think may be useful. Or, if you have general questions, post them here and someone else may have the answer. This can include everything in SAS, not just BASE or STAT.
So, I'll start with proc sql. Lots of times I'll have specific rows in mind that I want from a table, or I just want to look at the first few. But, SAS's implementation of SQL doesn't adhere to the ANSI standards and has their own proprietary stuff in there, so it took me a while to find out how to call specific rows.
The SAS command is MONOTONIC(). E.g., the syntax for selecting the first 100 rows from a table:
Never would've guess that one. For comparison, here is Oracle:
And T-SQL
So, I'll start with proc sql. Lots of times I'll have specific rows in mind that I want from a table, or I just want to look at the first few. But, SAS's implementation of SQL doesn't adhere to the ANSI standards and has their own proprietary stuff in there, so it took me a while to find out how to call specific rows.
The SAS command is MONOTONIC(). E.g., the syntax for selecting the first 100 rows from a table:
Code:
proc sql;
select x
from data
where monotonic() <= 100
; quit;
Code:
...
where rownum <=100
...
Code:
select top 100 x
...