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

I'm running into an odd sort of bug.  When I run a shorter tabulate statement I have a report with four distinct values of award_category_desc when I include more variables the output returns two distinct values of award_category_desc.  Due to legal reasons, I cannot post the dataset.  The values of the field are:

 

Doctoral Degree
Masters Degree
Post Masters Certificate
Postbaccalaureate Certificate

 

 

/*This block correctly returns a tabular that has four distinct values of award_category_desc*/
proc tabulate data=Time_to_Degree;	
	var Award_Count Time_to_Degree;
	class academic_year award_category_desc;
	table (award_category_desc="") , 
	academic_year *(Award_Count*f=8.0 Time_to_Degree*mean*f=8.1) all;
run;	
/*This block correctly returns a tabular that has four distinct values of award_category_desc*/
proc tabulate data=Time_to_Degree;	
	var Award_Count Time_to_Degree;
	class academic_year award_category_desc program_desc;
	table award_category_desc=""*program_desc="" , 
	academic_year *(Award_Count*f=8.0 Time_to_Degree*mean*f=8.1) all;
run;	

/*This block incorrectly returns a tabular that has two distinct values of award_category_desc as if I have a where clause*/
proc tabulate data=Time_to_Degree;	
	var Award_Count Time_to_Degree;
	class academic_year award_category_desc program_desc first_concentration_desc;
	table award_category_desc=""*program_desc=""*first_concentration_desc="" , 
	academic_year *(Award_Count*f=8.0 Time_to_Degree*mean*f=8.1) all;
run;	
1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Missing values for the added class variables is causing those observation to be ignored.  Use the MISSING option.

View solution in original post

3 REPLIES 3
data_null__
Jade | Level 19

Missing values for the added class variables is causing those observation to be ignored.  Use the MISSING option.

DavidPhillips2
Rhodochrosite | Level 12

Thanks that solved the issue.  It is odd that missing is required to not produce what seems like a bug.

ballardw
Super User

@DavidPhillips2 wrote:

Thanks that solved the issue.  It is odd that missing is required to not produce what seems like a bug.


Pretty well documented in the Proc Tabulate syntax for Class statement options MISSING.

 

Depending on the actual needs for your report you can add a variable that is occasionally missing to create filters in tables by nesting that variable in only some tables.

 

Another approach would be to add an appropriate variable to contain the "nested" class variables such as with one of the CAT functions. Then the only records not used would be where ALL of the nested variables were missing. I admit that might be odd to read but is an option where the values are pretty obvious.

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 473 views
  • 2 likes
  • 3 in conversation