Hi folks:
I'm trying to show the proportion of patients with missing stage by other covariates, for example, by age group in the image shown below.
My output is changed from WANTED to WRONG which you can see in the image below that the numbers for Breast cancer are changed before vs after adding the 'CANCER_SITE
' category into the proc tabulate to produce the statistics for four different cancer sites.
How to add CANCER_SITE
correctly in the proc tabulate code without changing the statistics that I'm showing in the WANTED part?
Please see my code snippet and mock data if needed.
PROC TABULATE DATA=BREAST_TABLE;
class MISS1 AGEGRP SEX RACETH STAGE1 SURGERY MEDICAID type_of_reporting_source
marital_status_at_dx CANCER_SITE/ASCENDING;
table ALL (AGEGRP SEX RACETH marital_status_at_dx SURGERY STAGE1 MEDICAID
type_of_reporting_source),CANCER_SITE=''*MISS1=''*ROWpctn ALL;
RUN;DATA HAVE;
INPUT GENDER MISS_STATUS;
/*IF MOCK DATA NEEDED*/
DATA HAVE;
INPUT AGEGRP MISS_STATUS CANCER_SITE;
DATALINES;
1 1 1
1 1 1
1 1 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
0 1 1
0 1 1
0 1 1
0 0 1
0 0 1
0 0 1
0 0 1
1 1 2
1 1 2
1 1 2
1 1 2
1 1 2
1 0 2
1 0 2
1 0 2
0 1 2
0 1 2
0 1 2
0 1 2
0 1 2
0 0 2
0 0 2
;
I greatly appreciate your time!
Change the table column specification from
,CANCER_SITE=''*MISS1=''*ROWpctn ALL
to
,CANCER_SITE=' ' * MISS1=' ' * (PCTN<MISS1>*f=6.2 N*f=comma9.0) ALL*F=comma9.0
I think PCTN is better than ROWPCTN at honoring your desired denominator for percent calculations.
Change the table column specification from
,CANCER_SITE=''*MISS1=''*ROWpctn ALL
to
,CANCER_SITE=' ' * MISS1=' ' * (PCTN<MISS1>*f=6.2 N*f=comma9.0) ALL*F=comma9.0
I think PCTN is better than ROWPCTN at honoring your desired denominator for percent calculations.
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.