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

Hello,

I would like to use the Missing option in the different classes below.  

I want Age/Sex/Race/Insurance/Underly (Missing value inclusion)  and Oxy/ICU/Incub/Ecmo/Died(Missing value exclusion). In addition, is there a way to get the SUM of each class in the Tabulate statement too?  Please guild me a way to do it.  Thanks.

 

proc tabulate data=ARI_UC_Elg_IDs;
   class Age Sex race Insurance oxy ICU Intub Ecmo Died Underly;
   tables (Age Sex race Insurance oxy ICU Intub Ecmo Died)*(n colpctn*f=4.2), Underly;
   where Age_group in (1,2,3);
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
PROC Star

You can have multiple CLASS statements, so to control MISSING option you can do:

proc tabulate data=ARI_UC_Elg_IDs;
   class Age Sex race Insurance Underly / missing ;
   class oxy ICU Intub Ecmo Died ;
   tables (Age Sex race Insurance oxy ICU Intub Ecmo Died)*(n colpctn*f=4.2), Underly;
   where Age_group in (1,2,3);
run;

There are examples in the docs about getting a sum.  You need to use a VAR statement to add an analytical variable.  See e.g. : https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p13k5zc709o4t3n1k9u2s7dsnzv9.htm 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

View solution in original post

3 REPLIES 3
Quentin
PROC Star

You can have multiple CLASS statements, so to control MISSING option you can do:

proc tabulate data=ARI_UC_Elg_IDs;
   class Age Sex race Insurance Underly / missing ;
   class oxy ICU Intub Ecmo Died ;
   tables (Age Sex race Insurance oxy ICU Intub Ecmo Died)*(n colpctn*f=4.2), Underly;
   where Age_group in (1,2,3);
run;

There are examples in the docs about getting a sum.  You need to use a VAR statement to add an analytical variable.  See e.g. : https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p13k5zc709o4t3n1k9u2s7dsnzv9.htm 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
ballardw
Super User

The ALL keyword on the table statement determines getting the statistics for all levels of a class variable combined.

 

SUM is reserved for VAR variables. To get a total N please see this:

proc tabulate data=sashelp.class;
   class sex age;
   table sex*(n pctn)  ,
         age 
   ;
   table (sex all)*(n pctn)  ,
         age 
   ; 
   table sex*(n pctn)  ,
         age all
   ;
   table (sex all)*(n pctn)  ,
         age all
   ;
run;

You weren't very clear as to which particular "sum" you might want so I include example without any "all" and then examples of each dimension.

Astounding
Opal | Level 21

Also note, if an observation is removed because of a missing value, it is totally removed.  It will be removed for the calculations based on other variables, even when those other variables do not have missing values.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 210 views
  • 6 likes
  • 4 in conversation