@ed_sas_member Wow thank you so much for your prompt reply! It worked for my dataset! However I have already come across another issue.. I need the average to be calculated for different groups. I tried to do it with "WHERE" statement, but I want the other data to remain in the data set as well [more like if ... then do avg(value) else .]? PROC SQL;
CREATE TABLE mydata_temp AS
SELECT Touchpoint, Unit, Date format=monyy.,
avg(NPS_value) as monthly_avg_claimsnl
FROM mydata
WHERE Unit = 'N' AND Touchpoint = '1'
group by year(date), month(date)
order by month(date), day(date), year(date);
QUIT;
PROC SQL;
CREATE TABLE mydata_temp AS
SELECT Touchpoint, Unit, Date format=monyy.,
avg(NPS_value) as monthly_avg_claimsnl
FROM mydata
WHERE Unit = 'F' AND Touchpoint = '2'
group by year(date), month(date)
order by month(date), day(date), year(date);
QUIT; attached I tried to show the preffered output. Thank you so much!. Best,
... View more