DATA Step, Macro, Functions and more

Placement in correct tab

Posts: 59

Placement in correct tab

data loans(keep=loan_num log_code filter);

set loan1;


Here is the scenario for the log codes.

if the log code is

TLS only (log code) – Received tab

TLS and TCD (log codes) – Pending

TLS and TMOD (log codes) – Reset

The issue is TLS can appear in all three scenarios, in scenarios 2 and 3, the second log code dictates the tab.

if log code = 'TLS' and log code not in ('TCD','TMOD') the filter = 'TLS';

if log code in('TLS','TCD)

I want the filter to populate with Received, Pending or Reset.  What complicates this is TLS can appear in all 3 scenarios.

Super User
Posts: 13,508

Re: Placement in correct tab

Posted in reply to omega1983

Are those actual data lines? If not actual, or at least the way it actually will appear in the data would be more helpful.

If log code in ('TLS','TCD')  won't do what you want as this is true if the entire code is either of these values.

you may be looking for

if findw(Log_code,'TLS')>0 and findw(Log_code,'TCD')>0 then filter='Pending';

Valued Guide
Posts: 2,191

Re: Placement in correct tab

Posted in reply to omega1983

Does this data have key (or id) columns to group by?

I'm assuming when a group has the appropriate collection it belongs in one of the three tabs.

The design i would propose makes a join of 3 streams having just one type of data in each stream. But that approach needs a definition of the grouping.

With ordered data the 3 tabs could be written by a single data step. Proc sql wouln't need ordered data but can only write one tab at a time.


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation