Help using Base SAS procedures

How to make a table with a discretion picture format

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

How to make a table with a discretion picture format

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


Accepted Solutions
Solution
‎12-11-2011 11:15 PM
Contributor
Posts: 53

Re: How to make a table with a discretion picture format

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


All Replies
PROC Star
Posts: 7,471

How to make a table with a discretion picture format

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;

Solution
‎12-11-2011 11:15 PM
Contributor
Posts: 53

Re: How to make a table with a discretion picture format

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.

Occasional Contributor
Posts: 14

How to make a table with a discretion picture format

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

Contributor
Posts: 53

Re: How to make a table with a discretion picture format

No worries

Trusted Advisor
Posts: 1,301

How to make a table with a discretion picture format

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;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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