HI Thankyou. here is the code i executed two steps separtely but in the second step got error as I would like to check count by distinct x with monthyear >jan2022 (here we cant pass as monthyear as jan2022 so we put 31jan2022, but data should full by monthyear all the feb count should be 2, march 2,april 2 and by monthyear. proc sql; create table tt as select intnx('month',datepart(datetime),0) format=monyy7. as monthyear, x from have; quit; MONTHYEAR X 1 JAN2022 8 2 JAN2022 2 3 FEB2022 7 4 FEB2022 5 5 MAR2022 3 6 MAR2022 4 7 APR2022 6 8 APR2022 9 69 proc sql; 70 select intnx('month',monthyear,0) format=monyy7. as monthyear,count(distinct x) as s 71 from tt 72 where monthyear>'31JAN2022'd 73 group by calculated monthyear, S; ERROR: Summary functions are restricted to the SELECT and HAVING clauses only.
... View more