BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

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 TAB WENT WRONG.png

 

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!

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

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.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

2 REPLIES 2
mkeintz
PROC Star

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.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Cruise
Ammonite | Level 13
The suggested change solved the problem. I would not have thought of this modification unless you pointed out. I greatly appreciate your help. Thanks a lot!

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