Printmiss for columns only

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Printmiss for columns only

Hi,

I am creating a basic proc tabulate table and I want printmiss to work for columns only i.e. I want all the columns (including those with no data) to be displayed, but only the rows with data to be displayed.

Is there an easy way to do this with printmiss on the table statement? Or is there another quick alternative?

Thanks for the help,

Rob


Accepted Solutions
Solution
‎05-08-2013 10:42 AM
Super User
Posts: 10,527

Re: Printmiss for columns only

Still need an example of what kind of output you are wanting.

Since the offending variable is apparently a date from the name this brings up other issues. If there is a specific range of dates of interest you may want to create a custome format for the levels you want displayed and use the PRELOADFMT option on the class statement for _date. Add table option / printmiss as well.

View solution in original post


All Replies
Super User
Posts: 10,527

Re: Printmiss for columns only

You might want to post some example data and desired outcome.

If the column variables are class variables you might want to modify the class statment(s) to something like:

Class ColumnVar1  ColumnVar2 / missing ;

But not for row class varaibles.

Class RowVar1 RowVar2;

Occasional Contributor
Posts: 7

Re: Printmiss for columns only

This sounds like exactly what I want, but I won't be able to test it until I'm back in the office on Wednesday. I'll provide feedback then.

Thank you so much for your help!!

Occasional Contributor
Posts: 7

Re: Printmiss for columns only

Thank you both.

ballardw: I have tested your suggestion and unfortunately the table is still missing columns with no data (count of observations). I haven't noticed any change to the tables. Below is my programme and an explanation.

Ksharp: Thank you for the alternative method, however I'm very new to SAS and have never used proc report before! I'd prefer to stick with tabulate for the time being Smiley Happy

Thank you once again for whatever assistance you can provide!!

-------------------------------------------------------------------------------------

Brief explanation:

Countries are split into separate tables/pages. Each country contains "sites" (rows) which recruit patients over months "_date" (columns). I want the tables to display the count of the number of observations (patients) per site, per month.

Ideally I would like all country tables to have the same column set, spanning the full range of all months in the data file. However it is vital none of the months (columns) are missing in between the 'first' and 'last' month (columns) per country.

FYI: I work in medical research for a university, not a pharmaceutical.

-------------------------------------------------------------------------------------

data All;

    set WORK.DATAMONITORING;

    keep country_name organisation_name _date;

    label     country_name='Country'

            organisation_name='Site'

            _date ='Date of recruitment (mm/yyyy)';

    format _date mmyys7.;

    _date=input(trim(dateRandomisation),ddMMYY10.);   

run;

proc sort data=All;

    by country_name;

run;

options nobyline;

proc tabulate data=All;

    by country_name;

    weight count;

    class country_name organisation_name;

    class _date / missing;

    classlev organisation_name _date / S=[background=CXC9D4F9];

    table country_name="",

          organisation_name="Site" all='Total'*[style=[background=cornsilk font_weight=bold]],

          (_date all='Total'*[style=[background=cornsilk font_weight=bold]])*(N=' ');

    title '#byval(country_name) recruitment';

run;

ods html close;

ods listing;

-------------------------------------------------------------------------------------

Solution
‎05-08-2013 10:42 AM
Super User
Posts: 10,527

Re: Printmiss for columns only

Still need an example of what kind of output you are wanting.

Since the offending variable is apparently a date from the name this brings up other issues. If there is a specific range of dates of interest you may want to create a custome format for the levels you want displayed and use the PRELOADFMT option on the class statement for _date. Add table option / printmiss as well.

Occasional Contributor
Posts: 7

Re: Printmiss for columns only

Hi ballardw - thanks for your help. I realise what's happened with your previous advise of adding "/ missing" to the class statement. Some tables now include a "." (blank) column. Unfortunately this wasn't what I needed - and is probably because this is a 'count' table, counting observations. As advised, here is one of the tables.

As you can see there are no columns for 07/2012, 08/2012 etc. I would like these columns displaying a "0".

I think you are right. I will need to do research into PRELOADFMT to get around this problem. I need to avoid PRINTMISS though because it will display all sites for all countries in each country table.

Thank you for your help

Super User
Posts: 10,527

Re: Printmiss for columns only

The Preloadfmt will also work with ORDER=DATA for the specific variable. However you do not want PRELOADFMT used with a variable using a supplied SAS date format.

Super User
Posts: 9,687

Re: Printmiss for columns only

An alternative way is   proc report + completecolumns   option

☑ This topic is SOLVED.

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

Discussion stats
  • 7 replies
  • 382 views
  • 6 likes
  • 3 in conversation