Hi, As LinusH mentioned there is calculated. However you can also do these things by subquerying. There are times when each method is useful, depending on the complexity of the SQL being created. The below is logically the same, the first using a value which is calculated within the same select, the second having that value created as part of the select in the subquery. In this simple example it may look a bit pointless, however if you are writing large queries which utilize many datasets, calculations, grouping etc. (say something like and ADSL table) then it can be useful to pre-process data going into your query to simplify things. proc sql; create table ... as select values, case when else, case calculated when else from a_dataset; quit; proc sql; create table ... as select values, case when calculated else from (select values, case when else as calculated from a_dateset); quit;
... View more