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

Hi, 

 

As you can see on the example below, I'm trying to create multiple tables on the same dataset however, I want specific variables to be shown in each table. Problem is, the way I'm doing, all tables end up having all the variables I've mentioned in all keep statements.

 

Example:

 

data rule_01 rule_02 rule_03 rule_04;
           set have;
           if rule_01 = 'fail' then output rule_01; keep reason_1 rule_01;
           if rule_02 = 'fail' then output rule_02; keep ID reason_2 rule_02;

           if rule_03 = 'fail' then output rule_03; keep reason_3 rule_03;

           if rule_04 = 'fail' then output rule_04; keep reason_4 rule_04;

run;

 

thank you 🙂

1 ACCEPTED SOLUTION
2 REPLIES 2

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 489 views
  • 1 like
  • 3 in conversation