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

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

1 ACCEPTED SOLUTION

Accepted Solutions
VX_Xc
Calcite | Level 5

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.

View solution in original post

5 REPLIES 5
art297
Opal | Level 21

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;

VX_Xc
Calcite | Level 5

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.

Dan_yu_W
Obsidian | Level 7

Thanks. The format worked great. Saved me (and my co-workers) a lot of time.

FriedEgg
SAS Employee

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1281 views
  • 0 likes
  • 4 in conversation