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.
SAS Forward: Real Stories, Live Demos and AI Innovation
Ask the Expert
Join us November 4-5 for SAS Forward, a virtual event exploring modern analytics, AI and intelligent decisioning. Discover real-world success stories, explore emerging trends, and see the latest SAS innovations in action through expert-led sessions and live demonstrations.
The part I'm getting stuck on is that there's not a single maximum value to continue the numbering from since my data is grouped. I can't restart the numbering because I want to preserve the old data, which isn't always sequential and doesn't always start at 1. Here is the data I'm starting with: data old;
INPUT patient $ repeat_instance episode_number visit_date :MMDDYY10.;
FORMAT visit_date MMDDYY10.;
datalines;
A 1 1 01/12/2026
A 2 2 01/16/2026
A 4 3 02/04/2026
B 1 1 01/05/2026
B 2 2 01/09/2026
C 1 1 01/10/2026
D 2 1 01/18/2026
D 3 2 01/31/2026
D 5 3 02/05/2026
;
run; Here's the new data I want to add: data new;
INPUT patient $ repeat_instance episode_number visit_date :MMDDYY10.;
FORMAT visit_date MMDDYY10.;
datalines;
A . 4 02/12/2026
B . 3 01/16/2026
B . 4 02/04/2026
C . 2 03/05/2026
D . 4 03/09/2026
D . 5 04/10/2026
;
run; I'm combining the data in a simple data step and sorting: data combined;
set old new;
run;
proc sort data=combined; by patient episode_number; run; This is what the dataset combined looks like: patient repeat _instance episode_number visit_date A 1 1 01/12/2026 A 2 2 01/16/2026 A 4 3 02/04/2026 A . 4 02/12/2026 B 1 1 01/05/2026 B 2 2 01/09/2026 B . 3 01/16/2026 B . 4 02/04/2026 C 1 1 01/10/2026 C . 2 03/05/2026 D 2 1 01/18/2026 D 3 2 01/31/2026 D 5 3 02/05/2026 D . 4 03/09/2026 D . 5 04/10/2026 This is what I want: patient repeat_instance episode_number visit_date A 1 1 01/12/2026 A 2 2 01/16/2026 A 4 3 02/04/2026 A 5 4 02/12/2026 B 1 1 01/05/2026 B 2 2 01/09/2026 B 3 3 01/16/2026 B 4 4 02/04/2026 C 1 1 01/10/2026 C 2 2 03/05/2026 D 2 1 01/18/2026 D 3 2 01/31/2026 D 5 3 02/05/2026 D 6 4 03/09/2026 D 7 5 04/10/2026 Basically, I want repeat_instance to be the max value of the old data, grouped by patient, plus 1. I've used the retain function when numbering from scratch, or for continuing numbering that's not grouped. I'm thinking of using the lag function but can't quite figure out how that would work beyond the first new value of the group. Here's what I've tried with the lag function and the resulting data: data lag;
set combined;
by patient;
lag_repeat_instance=lag(repeat_instance);
run;
data lag_ct;
set lag;
by patient;
retain repeat_instance;
if repeat_instance=. then repeat_instance=lag_repeat_instance+1;
run; patient repeat_instance episode_number visit_date lag_repeat_instance A 1 1 01/12/2026 . A 2 2 01/16/2026 1 A 4 3 02/04/2026 2 A 5 4 02/12/2026 4 B 1 1 01/05/2026 . B 2 2 01/09/2026 1 B 3 3 01/16/2026 2 B . 4 02/04/2026 . C 1 1 01/10/2026 . C 2 2 03/05/2026 1 D 2 1 01/18/2026 . D 3 2 01/31/2026 2 D 5 3 02/05/2026 3 D 6 4 03/09/2026 5 D . 5 04/10/2026 . I was hoping there is a better solution that I'm not thinking of. Thanks in advance!
... View more
Team Name Protoflow Track Health Care and Life Sciences Use Case Assess compatibility of a RWD source with an existing study protocol Technology SAS Viya Region NA and EMEA Team lead Caroline Osborne Team members Arpita Deb, Vijay Pasapula Social media handles Is your team interested in participating in an interview? Y Optional: Expand on your technology expertise
... View more
Hello, I have data test; z='x+y'; x=1; y=2; w=input(z,comma9.); run; I need w=3, but for some reason it is just a missing value, w=. Thanks
... View more
SAS Viya column lineage is only available for flows that are stored in Content. However, Git is only available for flows on NFS. Unfortunately, these are mutually exclusive options. Are more people running into this issue, and are there any ideas for possible workarounds
... View more
By MAGGObsidian | Level 7SAS Viya09-13-202602:58 PM