DATA Step, Macro, Functions and more

Removing Blank Columns in Proc Report

Accepted Solution Solved
Reply
Contributor
Posts: 56
Accepted Solution

Removing Blank Columns in Proc Report

Is there a way to remove blank columns from a proc report? Essentially I want to remove any blank column since that is a combination that does not exist.

 

 

report.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

proc report nowindows data=mgp_Mean_Merge (where=(Matrix='Soil')) spanrows nowd;
	columns timepoint Temperature ( 'Mean (Stdev, Percent Detected)' SBvalue,sample_org,moisture,bead);
	define timepoint / group order=internal style(column)=[vjust=m just=l] format=timepoint. 'Timepoint';
	define Temperature / group order=internal format=temp. 'Temperature';
	define sample_org /  across '';
	define moisture / across '' format=wetdry.;
	define bead / across '';
	define SBvalue / group '';
run;

Accepted Solutions
Solution
‎04-23-2018 07:45 AM
Super User
Posts: 10,681

Re: Removing Blank Columns in Proc Report

Posted in reply to michelconn
	define sample_org /  across ''  NOZERO ;
	define moisture / across '' format=wetdry.  NOZERO;
	define bead / across ''   NOZERO;

View solution in original post


All Replies
Valued Guide
Posts: 558

Re: Removing Blank Columns in Proc Report

Posted in reply to michelconn

If you don't want them in your report then drop those variables (variables with all missing values) before running the proc report.

Check this solution to drop variables with null values; https://communities.sas.com/t5/SAS-Procedures/Dropping-variables-with-null-values/td-p/185892

Thanks,
Suryakiran
Super User
Posts: 13,293

Re: Removing Blank Columns in Proc Report

Posted in reply to michelconn

You might consider moving to proc tabulate as nested column/row combinations by default only have populated ones in the output assuming none of the records are actually missing the group or across variables (class in Tabulate)

 

Since you don't show what variable is actually analyzed I can't get more specific than that

Solution
‎04-23-2018 07:45 AM
Super User
Posts: 10,681

Re: Removing Blank Columns in Proc Report

Posted in reply to michelconn
	define sample_org /  across ''  NOZERO ;
	define moisture / across '' format=wetdry.  NOZERO;
	define bead / across ''   NOZERO;
Contributor
Posts: 56

Re: Removing Blank Columns in Proc Report

That worked perfect, thanks!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 113 views
  • 1 like
  • 4 in conversation