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~~~
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..
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..
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.