Hi All,
I hope this message finds you all well.
Please kindly assist me. I am stuck. I have 841 accounts and would like to do a 50/50 of these accounts between 2 debt collectors. Please see my current code below:
data _null_;
prev_month = intnx('month',today(),-1);
last_month = intnx('month',today(),0);
call symputx("prev_month_m2y2",put(month(prev_month),z2.)||put(prev_month,year2.),4.);
call symputx("last_month_m2y2",put(month(last_month),z2.)||put(last_month,year2.),4.);
call symputx("this_month_m2y2",put(month(today()),z2.)||put(today(),year2.),4.);
run;
proc sql;
create table INSPIRE.INSPIRE_MATTERS_&last_month_m2y2._updated as
select a.*, b.current_edc_no2, b.current_edc_no2_date, c.account_guid, c.cd
from INSPIRE.INSPIRE_MATTERS_&last_month_m2y2 as a
left join (
select distinct case when substr(account_guid,1,4) = "7300" then substr(account_guid,5,6)||substr(account_guid,1,4) else account_guid end as account_guid,
"ARA Wayne Druian" as current_edc_no2, today() as current_edc_no2_date format date9.
from ara_accounts
) as b
on a.'matter number'n = b.account_guid
left join (
select account_guid, cd
from INSPIRE.STATEMENTS_STATS_&last_month_m2y2
) as c
on a.'matter number'n = c.account_guid;
quit;
data ara_matter_import_&last_month_m2y2;
set INSPIRE.INSPIRE_MATTERS_&last_month_m2y2._updated;
if current_edc_no2 = "ARA Wayne Druian";
drop last_month_edc edc_action current_edc current_edc_no2 current_edc_no2_date;
run;
proc export data= ara_matter_import_&last_month_m2y2
outfile="\\lewexcal\ARA Inspire\Inbox\ara_matter_import_blake_&last_month_m2y2..csv"
dbms=dlm replace; delimiter=";";
run;
Ok. There are many ways to do this. Here is a small example that splits the sashelp.class data set into two data sets one and two
data one two;
set sashelp.class;
if mod(_N_, 2) = 0 then output one;
else output two;
run;
Do you want to split up the data into two data sets or simply a 1/2 variable to indicate the debt collector?
I'd like to split into 2 data sets, please.
Ok. Just to be clear.. I assume that you want to split the data set ara_matter_import_&last_month_m2y2 into two equally sized data sets correct?
Ok. There are many ways to do this. Here is a small example that splits the sashelp.class data set into two data sets one and two
data one two;
set sashelp.class;
if mod(_N_, 2) = 0 then output one;
else output two;
run;
Glad you found your answer
proc surveyselect data=sashelp.class out=temp groups=2;
run;
data one two;
set temp;
if groupid=1 then output one;
else output two;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.