Skip to main content

EXCEPT

EXCEPT fieldlist

fields A comma-delimited list of data fields in a RECORD structure.

The EXCEPT keyword specifies a list of fields not to use in a SORT, GROUP, DEDUP, or ROLLUP operation. This allows you to perform the operation on all fields in the RECORD EXCEPT those fields you name, making the code more readable and maintainable.

Example:

x := DATASET([{'Taylor','Richard','Jackson' ,'M'},
            {'Taylor','David' ,'Boca' ,'M'},
            {'Taylor','Rita' ,'Boca' ,'F'},
            {'Smith' ,'Richard','Mansfield','M'},
            {'Smith' ,'Oscar' ,'Boca' ,'M'},
            {'Smith' ,'Rita' ,'Boca' ,'F'}],
            {STRING10 lname, STRING10 fname,
            STRING10 city, STRING1 sex });
y := SORT(x,EXCEPT sex); //sort on all fields but sex

OUTPUT(y)

See Also: SORT, GROUP, DEDUP, ROLLUP