SAS Examples: Proc SQL

SAS Examples: Proc SQL

Last updated:
Table of Contents

Select top N rows

proc sql outobs=100;
    select *
    from namespace.my_database;
quit;

Case when

proc sql;
    select case 
        when <condition> then <some value>
        when <other condition> then <other value>
        else <yet another value>
    end as <field_alias>
    from <namespace>.<table_name>;
quit;

Create an index for an existing table

For indexes with a single column, the index name must be the same as the column name

proc sql;
    create index <index_name>
        on <namespace>.<table_name>(<column_name>);
quit;