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;
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
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 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.
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.
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!
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.