BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
1 REPLY 1
data_null__
Jade | Level 19
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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 1 reply
  • 773 views
  • 0 likes
  • 2 in conversation