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
Super User

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 

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.

View solution in original post

3 REPLIES 3
Quentin
Super User

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 

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
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
PROC Star

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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 972 views
  • 6 likes
  • 4 in conversation