BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MagD
Quartz | Level 8

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;

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

8 REPLIES 8
PeterClemmensen
Tourmaline | Level 20

Do you want to split up the data into two data sets or simply a 1/2 variable to indicate the debt collector?

MagD
Quartz | Level 8

I'd like to split into 2 data sets, please.

PeterClemmensen
Tourmaline | Level 20

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? 

MagD
Quartz | Level 8
Yes, that is correct.
PeterClemmensen
Tourmaline | Level 20

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;
MagD
Quartz | Level 8
Thank you! It works perfectly!
PeterClemmensen
Tourmaline | Level 20

Glad you found your answer

Ksharp
Super User
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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 8 replies
  • 1964 views
  • 4 likes
  • 3 in conversation