Typically the keyword CALCULATED is required any time a variable is calculated and used within the same query within a RPOC SQL step. However, lately I found that it also works WITHOUT the keyword in a GROUP BY clause.
In the codes below, typically we should use GROUP BY Calculated XID; but it did work without the keyword. Any idea? I guess it's a SAS version issue, where in the later versions the rules for GROUP BY is loosened up?
data block; do block = 4 to 16 by 4; do i=1 to 3; x=block+i; output; end; end; drop i; run;
proc sql; create table test as select block, x, x**2 as xsq, mean(calculated xsq) as meanXsq, calculated xsq**.5 as XID from block group by XID; quit;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.