I have to get pre and post sums based on install date. The date is in the variable name which i capture using the vname. I am having trouble creating an index on the variables to sum each one based on their install date.
here is my code so far. I am missing something to capture the index of months. I saw a similar post about this but cannot find it anymore.
Transpose your usage_* variables to a long dataset, and extract the month as a date from _NAME_.
out=long (rename=(col1=usage) where=(usage not in (0,.)))
by /* insert your identifying key here */;
month = input(scan(_name_,2,'_'),yymmn6.);
format month yymmn6.;
by /* insert key here */;
then sum_usage = 0;
if intnx('month',pre_start_dt,0,'b') le month le pre_end_dt then sum_usage + usage;
drop month usage;
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.