BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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...
deleted_user
Not applicable
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1072 views
  • 0 likes
  • 2 in conversation