Hi all,
Hope you all are doing great and stay safe during the pandemic. I would like to combine several "Select" statements where I calculate the average of the variables under one "Proc SQL". Below is the code I use and it works, but I use this code for each variable separately and producing unnecessary files. I want to get the average of other variables like length, age, ... for the same ID under this code. I appreciate your time and help.
proc sql;
create table want as
select
id,
avg(var1) as var1,
avg(var2) as var2
from have
group by id
;
quit;
proc sql;
create table want as
select
id,
avg(var1) as var1,
avg(var2) as var2
from have
group by id
;
quit;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.