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;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.