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

I am running into some issues getting PROC TABULATE to correctly count the frequency of my categorical variables. A snippet of the Log file and the output of both the PROC TABULATE (top table) and the PROC FREQ (bottom table of gender) are below. My code is as such: 

title 'Table 1. Child Demographics';
*Does not like ATEAM_AUTISM_TYPE --> Assess outside of True/False positives;
PROC TABULATE data = CLEANED.Analytic_Data;
 options fmtsearch = (OUTPUT);
 keyword n / style = [just=R];
 keyword pctn / style = [just=L];
 class ATEAM_AUTISM_YES_NO CHILD_GENDER ATEAM_AUTISM_TYPE ASD_DTEAM_COMORBID_YESNO;  
 classlev CHILD_GENDER ATEAM_AUTISM_TYPE ASD_DTEAM_COMORBID_YESNO/ s = [just=R];
 table (CHILD_GENDER = 'Sex of Child' ATEAM_AUTISM_TYPE = 'Type of Autism' ASD_DTEAM_COMORBID_YESNO = 'Comorbidity Present'),
       (ALL = 'All Data ~nn (%)' ATEAM_AUTISM_YES_NO = 'A Team Autism Diagnosis')*(n ='' * [style = [just=R cellwidth = 75] f = 8.2]
	    											  	      pctn ='' * [style = [just=L cellwidth = 80] f = paren.]) / box = 'Child Variables';
 format ATEAM_AUTISM_YES_NO asd_perc. CHILD_GENDER sex. ATEAM_AUTISM_TYPE $asdtype. ASD_DTEAM_COMORBID_YESNO yesno.;
RUN; *Not stratifying properly;

PROC FREQ data = WORK.Data2019;
 table ATEAM_AUTISM_YES_NO*(CHILD_GENDER ATEAM_AUTISM_TYPE ASD_DTEAM_COMORBID_YESNO);
 options fmtsearch = (OUTPUT);
 format ATEAM_AUTISM_YES_NO asd. CHILD_GENDER sex. ATEAM_AUTISM_TYPE $asdtype. ASD_DTEAM_COMORBID_YESNO yesno.;
run;

For whatever reason, false positive isn't showing up at all. Furthermore, the numbers calculated for overall and true positive don't even match the frequency table. I am unsure where SAS got these values nor why PROC TABULATE would produce different results from PROC FREQ. 

I used similar code formatting for continuous variables stratified for Autism diagnosis and got matching results to PROC MEANS. I am not sure why it works well with some and not others. Does anyone have any ideas what could be causing this issue? Thank you in advance.

 

 Table1_Problems.pngTable1_Log.png

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star
PROC TABULATE automatically removes observations where any CLASS variable has a missing value. You can override that behavior by adding the MISSING option to the PROC statement.

View solution in original post

2 REPLIES 2
qoit
Pyrite | Level 9

Hard to say what's causing the issue unless one views the data portion of the dataset. Having said that, do you think that the ROW level of the TABLES statement of the tabulate procedure limiting the view, perhaps simplify it by only using one variable as below for a comparison with FREQ procedure:

 

 table CHILD_GENDER = 'Sex of Child',
       (ALL = 'All Data ~nn (%)' ATEAM_AUTISM_YES_NO = 'A Team Autism Diagnosis')*(n ='' * [style = [just=R cellwidth = 75] f = 8.2]
	    											  	      pctn ='' * [style = [just=L cellwidth = 80] f = paren.]) / box = 'Child Variables';

Alternatively, use REPORT procedure.

Astounding
PROC Star
PROC TABULATE automatically removes observations where any CLASS variable has a missing value. You can override that behavior by adding the MISSING option to the PROC statement.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1056 views
  • 1 like
  • 3 in conversation