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

data a;

input x y;

datalines;

1 2

1 2

1 2

1 2

;

run;

proc freq data=a;

table x*y/out=out outpct;

run;

This procedure will generate a 1*1 crosstab ;

If the range of x is 1-4 and the range of y is 1-4,how can i generate a fixed 4*4 table counting the zero counts?

Thanks~~~

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

One way:

 

You have to tell the procedure that these values exist.

=> Add the corresponding records to the data,with a value of zero.

 

You then have to tell the procedure that these values must be used.

=> Add a WEIGHT variable and use the WEIGHT statement with the ZEROS option..

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

One way:

 

You have to tell the procedure that these values exist.

=> Add the corresponding records to the data,with a value of zero.

 

You then have to tell the procedure that these values must be used.

=> Add a WEIGHT variable and use the WEIGHT statement with the ZEROS option..

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 490 views
  • 0 likes
  • 2 in conversation