how to get 0 in out put

Reply
N/A
Posts: 0

how to get 0 in out put

Hi any one can tell me the following problem.
I have dataset name called xx,having variable name called x, x contains thefollowing data:
2
3
5

Now i want to run freq on xx.

proc freq data=xx;
tables x/out=ss;
where x=4;
run;
now i want to get output data set ss as count=0 percent=0% to get this what option i should use.

thanks and regards.
ram.
Respected Advisor
Posts: 3,775

Re: how to get 0 in out put

You could take advantage of features of PROC SUMMARY that allow you to manufacture data. Also the ZEROS option on the WEIGHT statement in PROC FREQ.


data test;
input x @@;
cards;
2 3 5
;;;;
run;
proc format;
value fx 1='1' 2='2' 3='3' 4='4' 5='5';
run;
proc summary nway completetypes;
class x / preloadfmt;
format x fx.;
output out=work.full;
run;
proc freq data=full;
tables x / out=ss(where=(x eq 4));
weight _freq_ / zeros;
run;
proc print;
run;
Ask a Question
Discussion stats
  • 1 reply
  • 259 views
  • 0 likes
  • 2 in conversation