Hello.
My problem is the following:
Usually in my tables (from either proc freq/tabulate) some cells contain very low observations. I'm not allowed to print these out due to "legal" reasons (since the people in my sample data have to be anonymous, table of workplace adress could in theory find who the person is, if only 1 person work at the workplace).
Using the above example, I usually make a new dataset containing a list of workplaces with more then 5 observations (make a new variable called "maxcount") from the original dataset, and than merge this back and write something like:
data X; set X_original; where maxcount_workplace>5; run;
In order to get a table with workplaces with more than 5 employees.
This is quite time consuming (even with a copy/paste of the syntax approach).
I heard that making a picture format could give me the same result e.g. changing the actual result/cells in a table giving some conditions (something like: if "cell value in a table"<=5 then replace with " -/missing/something else ".)
I hope the above is less confusing than it probably is, but I really would appreciate it if someone can tell me of it is possible with a picture format to do the above.
Regards
Dan
Proc Format;
Value LFive
0 -< 5 = 'Something Else';
run;
proc tabulate data = sashelp.shoes FORMAT = LFive.;
class region subsidiary;
var stores;
table subsidiary ALL, MEAN*region*stores;
run;
Make the Format such as above first then add it to your proc tabulate statement.
You could accomplish the task in one proc sql step. E.g.:
proc sql;
create table want as
select *
from sashelp.class
group by age
having count(age) gt 4
;
quit;
Proc Format;
Value LFive
0 -< 5 = 'Something Else';
run;
proc tabulate data = sashelp.shoes FORMAT = LFive.;
class region subsidiary;
var stores;
table subsidiary ALL, MEAN*region*stores;
run;
Make the Format such as above first then add it to your proc tabulate statement.
Thanks. The format worked great. Saved me (and my co-workers) a lot of time.
No worries
Assume all your workplace datasets are in the same library then use dictionary tables:
libname wp '/my/files';
proc sql;
create table gt5 as
select memname
from sashelp.vtable
where libname='WP' and nobs>4;
quit;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.