BookmarkSubscribeRSS Feed
Sandeep77
Lapis Lazuli | Level 10

Hi all,

I am trying to find which previousrepcode has moved to paying accountstatus from the below sample table. I want to get a table which shows the count of how many 122, 168, 157, etc repcodes are in the paying accountstatus. I am confused to use the proc freq to get this information or proc sql. I have used the below code and this gives me information about the previousrepcode and paying_repcode. I want to count how many times 168, 122 etc are in paying. Thanks

AccountNumber	PreviousRepCode	nextstatus	dt_curbal	DateAccountMoved	Sector	accountstatus
321784639	122	005H	145.55	02-Nov-22	Comms	Review
272652868	168	005H	60.72	03-Nov-22	Utilities	Paying
250411519	168	005H	47.09	03-Nov-22	Comms	Review
340751155	122	005H	1186.47	03-Nov-22	Comms	End of cyle
291453173	157	005H	889.12	03-Nov-22	Financial	Paying

proc sql;
create table Paying_info as 
select 
PreviousRepCode,
accountstatus as Paying_repcodes
from out_trace_op_status
where accountstatus like 'Paying';
quit;
3 REPLIES 3
PaigeMiller
Diamond | Level 26

Could you please provide data as working SAS data step code (as you did here)?

 

Either SQL or FREQ ought to work here. FREQ may require some data step manipulation to get there.

--
Paige Miller
Sandeep77
Lapis Lazuli | Level 10

Hi,

Apologies for that. I have created a test working data and adding it below. 

data test;
input PreviousRepCode accountstatus;
datalines;
122	Review
168	Paying
168	Review
122	End of cycle
157	Paying
;
run;
PaigeMiller
Diamond | Level 26

Please be kind enough to test your code first to make sure it works (and fix it if it doesn't work). This code doesn't work.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 408 views
  • 0 likes
  • 2 in conversation