“Dauer” is the column title, not the field or the “alias” of the field. Because that you can’t use SORT Dauer DESC because Dauer doesn’t exist as a field.
To solve this you have two ways:
You can repeat the duration calculation: SORT (dat-end - dat-beg).days DESC
You can use a trick with the flatten command to “build” a new variable named “Dauer”:
TABLE Dauer
WHERE Mus-type = "SA"
FLATTEN (dat-end - dat-beg).days AS Dauer
SORT Dauer DESC