The Visual Analytics Alphabet Series – A is for Aggregated Data!
Recent Library Articles
Today, is brought to you by the letter A… which is for Aggregated Data. Aggregated data sources in SAS Visual Analytics 8.3 create smaller, reusable tables of summarized data across selected categories to help improve report efficiency, with performance verified through benchmarking.
I have a macro. It works on column. The codes are below.
The real data need to work on is with BY GROUP.
The simulation is like below.
data _concave_(drop=);
do p=1 to 5 by 1;
do i=0 to 100;
x=i/100;
y=x**(p/2.0);
output;
end;
end;
run;quit;
How to make it work?! Chop and Conq and then Stich_Togehter surely works but too much elementary.
Anyone?!
Note the final output is "sum(second_diff) as net_concavity".
Thanks,
_____________________________________________________________________________
data _concave_(drop=i);
do i=0 to 100;
x=i/100;
y1=x**1.5;
y2=x**2.0;
y3=x**3.0;
output;
end;
run;quit;
%m_concaveness(data=_concave_, x=x, y=y1, out=_out_y1);
%m_concaveness(data=_concave_, x=x, y=y2, out=_out_y2);
%m_concaveness(data=_concave_, x=x, y=y3, out=_out_y3);
%macro m_concaveness(data=, x=, y=, out=);
proc sort data=&data;
by &x;
run;
data _temp_concave;
set &data;
lag_y = lag(&y);
dy = dif(&y);
run;
data _prep;
merge &data (rename=(&y=_y_prev &x=_x_prev))
&data
&data (firstobs=2 rename=(&y=_y_next &x=_x_next));
run;
proc sql noprint;
create table _second_diff as
select
a.&x as x_val,
a.&y as y_val,
(c.&y - 2*a.&y + b.&y) as second_diff
from &data as a
left join &data as b on a.&x > b.&x and not exists (select 1 from &data as c2 where c2.&x > b.&x and c2.&x < a.&x) /* 找到前一个点 */
left join &data as c on a.&x < c.&x and not exists (select 1 from &data as c3 where c3.&x < c.&x and c3.&x > a.&x) /* 找到后一个点 */
where b.&y is not null and c.&y is not null;
quit;
proc means data=_second_diff noprint;
var second_diff;
output out=&out
mean=mean_concavity
sum=sum_concavity
css=variance_concavity /*concaveness*/
n=n_points;
run;
data &out;
set &out;
run;
proc sql;
create table &out as
select
avg(second_diff) as mean_concavity label="(Mean Concavity)",
avg(abs(second_diff)) as mean_abs_concavity label="(Mean Absolute Curvature)",
sum(second_diff) as net_concavity label="(Net Concavity)",
count(*) as valid_points
from _second_diff;
quit;
proc datasets lib=work nolist;
delete _second_diff _temp_concave _prep;
quit;
proc print data=&out noobs;
title "Curve Overall Concaveness Measurement";
run;
%mend;
... View more
Hi, I have a SAS Visual Analytics dashboard with multiple objects and a month/date filter. For example, when the user selects Mar-2026: All normal objects should show Mar-2026 only. One special object (e.g., a line chart) should also respond to the selection but show the last 6 months, i.e. Oct-2025 to Mar-2026. When the user selects Apr-2026, the special object should show Nov-2025 to Apr-2026. The special object must remain interactive; I do not want to exclude it from the interaction. What is the recommended way to implement this in SAS Visual Analytics? Thank you.
... View more