Help using Base SAS procedures

Different results from Procs Freq and Tabulate

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

Different results from Procs Freq and Tabulate

Hi all,

 

I am running the following two procedures and getting different two very different results and can't figure out why:

 

proc tabulate data = index_ablations_all_years;
	class  ind_heavy_flag;
	table ind_heavy_flag, n colpctn*f=round10th. / nocellmerge;
	freq ind_DISCWT;
run;*/

proc freq data = index_ablations_all_years;
table ind_heavy_flag;
weight ind_DISCWT;
run;

This is running on SAS 9.4 on Windows 10, 64 bit.

 

Thanks for any help!

Ben

 

 


Accepted Solutions
Solution
‎02-28-2018 05:31 PM
Super User
Posts: 23,700

Re: Different results from Procs Freq and Tabulate

PROC TABULATE has both a FREQ and WEIGHT statement and they operate a little differently. 

Try using WEIGHT in both procedures if that's what you have. 

View solution in original post


All Replies
Valued Guide
Posts: 564

Re: Different results from Procs Freq and Tabulate

you might want to post data so that we can see the differences. 

Super User
Posts: 6,761

Re: Different results from Procs Freq and Tabulate

Do you have any missing values for IND_HEAVY_FLAG?  Without the MISSING option, PROC TABULATE throws those out entirely.  

Solution
‎02-28-2018 05:31 PM
Super User
Posts: 23,700

Re: Different results from Procs Freq and Tabulate

PROC TABULATE has both a FREQ and WEIGHT statement and they operate a little differently. 

Try using WEIGHT in both procedures if that's what you have. 

SAS Super FREQ
Posts: 9,366

Re: Different results from Procs Freq and Tabulate

Hi:
And COLPCTN could generate a different result than just PCTN. Missing might come into play as already noted -- without the MISSING option, TABULATE excludes missing CLASS values from the TABLE.

cynthia
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 205 views
  • 0 likes
  • 5 in conversation