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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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