BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
angeliquec
Quartz | Level 8
 Hi, I want to get the grand totals and subtotals of my HAVE dataset depending on the levels of my fields.
But let's say my HAVE dataset have null values for the other sublevels. After I execute the PROC REPORT, the level with incomplete sublevels disappear. 
 
In the dataset below, the first row disappears after running PROC REPORT. I'd like to know how can I retain this level (Level_1 = Grandfather) with missing sublevels. Thank you! 
 
 
/*Disappearing Row*/
data have;
input Group_Name :$20. Level_1 :$20. Level_2 :$20. Level_3 :$20. num;
datalines;
Group_a Grandfather . . 10
Group_a Grandmother Mother Daughter 90
Group_a Grandmother Father Daughter 80
;
run;
/*Get Subtotals For Each Report Level and Grand Total*/
ods select none;
proc report data=have out=dontwant nowd;
column group_name level_1 level_2
  level_3 num;
define group_name /group;
define level_1/group;
define level_2/group;
compute before group_name;
 Member=group_name;
endcomp;
compute before level_1;
 Member= level_1;
endcomp;
compute before level_2;
 Member= level_2;
endcomp;
break before level_1/summarize;
rbreak before/summarize;
run;
ods select all;
1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Please post code using running-man icon to increase readability.

 

Have you tried using the option "missing" in proc report statement?

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

Please post code using running-man icon to increase readability.

 

Have you tried using the option "missing" in proc report statement?

angeliquec
Quartz | Level 8
Thanks. The MISSING option works.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2 replies
  • 960 views
  • 0 likes
  • 2 in conversation