scottlittle
scottlittle

Reputation: 20822

Alias in SAS/SQL is not working

This SAS/SQL query returns a table DS_Dbtr_Status with column names FACS_Schema_ID and DBACCT and not the aliases as given.

proc sql outobs=10; **DS_Dbtr_Status**;
create table DS_Dbtr_Status as
    select
        FACS_Schema_ID as ID,
        DBACCT as ACCOUNT_NUM, 
         ...
    from sqlsrv10.acct_dbtr_status
    where Disposition ^= '9999';
quit;

Upvotes: 0

Views: 2320

Answers (1)

david25272
david25272

Reputation: 974

In SAS you can specify the label directly as a column modifier in the SELECT clause just by quoting it. The label= part of the modifier is optional:

    select
    FACS_Schema_ID as ID 'ID',
    DBACCT as ACCOUNT_NUM 'Account Number'

Using empty quotes will remove the labels:

    select
    FACS_Schema_ID as ID '',
    DBACCT as ACCOUNT_NUM ''

This doesn't affect the column name (which is determined by the alias), but does affect how the column appears in some procedures and in the table viewer.

Upvotes: 4

Related Questions