Hy,
I'm running this program:
proc sql;
select "TOTAL" as dest,
sum(Boarded) as Boarded format comma.
from sasuser.LAGUARDIA
outer union
select Dest,
sum(Boarded) as Boarded format comma.
from sasuser.LAGUARDIA
group by Dest;
quit;
and SAS shows me this result:
I'd like to see the result of the first query (total boarded) just under the result of the second query (total boarded group by destination) without missing data. Something like this:
Is it possible? If yes, could you help me...thank a lot!
Have a nice day,
Daniele
Drop the OUTER and let UNION work as intended.
If you want to impose an order than spell it out.
proc sql;
select "TOTAL" as sex
, sum(weight) as weight format comma.
, 1 as ordervar
from sashelp.class
union
select sex
, sum(weight) as weight format comma.
, 2 as ordervar
from sashelp.class
group by sex
order by ordervar, sex
;
quit;
Well, with the above being said, if you still want to force OUTER UNION to overlay columns corresponding to the first select query, then
try OUTER UNION Corr
But please restrain such practices in a production code.
Drop the OUTER and let UNION work as intended.
If you want to impose an order than spell it out.
proc sql;
select "TOTAL" as sex
, sum(weight) as weight format comma.
, 1 as ordervar
from sashelp.class
union
select sex
, sum(weight) as weight format comma.
, 2 as ordervar
from sashelp.class
group by sex
order by ordervar, sex
;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.