BookmarkSubscribeRSS Feed
MPaola
Calcite | Level 5
With a PROC REPORT is it possibile to put in output only those rows with a column value > x?

Example
Complete report:
GroupVariable_A |__B_|__C_|
aaaa __________|1000|2000|
bbbb __________|___0|___1|
cccc __________|5000|3000|

Desidered report (only rows with B >= 1000)
GroupVariable_A |__B_|__C_|
aaaa __________|1000|2000|
cccc __________|5000|3000|

Thanks
MPaola
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
It depends.

If B is based on a single observation, where GroupVariableA has been defined as a DISPLAY or ORDER variable, then a simple WHERE clause will eliminate the rows where _B is LT 1000 or GT X. However, if B is summarized based on your GroupVariable_A actually being defined with a usage of GROUP in PROC REPORT, then you will need to "pre-summarize" your data to determine which rows should "go forward" to PROC REPORT. There have been some previous postings on the subject, but it will be simple enough to do -- just use PROC MEANS, PROC SQL, PROC TABULATE and/or PROC REPORT to get summarized values and then eliminate the summarized rows that do not conform to what you want.

This does mean making 2 passes through the data. Just remember that any grand totals will not include those variables' values, if you eliminate the rows from the summary data -- unless you work on getting the numbers back in the total.

cynthia
Ksharp
Super User
And compute block will also can help you.


Ksharp
Ksharp
Super User
And compute block will also can help you.


Ksharp

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1467 views
  • 0 likes
  • 3 in conversation