Help using Base SAS procedures

Proc freq table option SPARSE

Reply
N/A
Posts: 0

Proc freq table option SPARSE

I am creating cross tabs by State. I know some of these cross tabs will be zero, but I want to see them and keep them in the output data set so i am using the option SPARSE. I am running into a problem where the output is not keeping all of the zero cross tabs. In particular, in my case I have two cross tabs with zero values but the output is only keeping the first one. See sample code below.

Anyone have any suggestions as to what I'm doing wrong? Has anyone else had this problem?


PROC FREQ DATA=one;
By State;
TABLE X1*X2 / out=test sparse; weight Z;
RUN;
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc freq table option SPARSE

From the SAS PROC FREQ DOC - you need the LIST option as well, I believe.

Scott Barry
SBBWorks, Inc.

http://support.sas.com/documentation/cdl/en/procstat/63032/HTML/default/procstat_freq_sect010.htm#pr...
N/A
Posts: 0

Re: Proc freq table option SPARSE

I gave it a try and it did not help. It looks to me like you only need either LIST or OUT= for sparse to work. I am having a weird situation because it appears to work for some but not for all. I am also running the same program for other years and I haven't had any problem.
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc freq table option SPARSE

Suggest you share an actual data-sample, both INPUT and OUTPUT, for another perspective from forum subscribers. Ideally the data would be pasted directly from your SAS log/list output, not hand-keyed.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 3 replies
  • 176 views
  • 0 likes
  • 2 in conversation