BookmarkSubscribeRSS Feed
PMroz
Fluorite | Level 6

Hello everyone,

Has anyone used ODS to produce output from JMP?  The quality of tabular output from JMP doesn't give you any control over fonts, bolding, spacing, boxes and lines, etc.  I can call a SAS program from within JMP, but I'm a total newbie at ODS.  Any examples would be great!

Thanks,

Peter

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  What is your procedure of choice for creating tabular output from SAS with ODS? Your program could be as simple as:

ods html file='c:\temp\simple.html' style=analysis;

    proc reg data=sashelp.class;

       model age=height;

    run;

    quit;

ods html close;

In the above program, the STYLE= option will create an HTML file that uses the ANALYSIS style definition (or style template) to provide overall style information which will impact the HTML result file look and feel. This will be true -- that the STYLE is used -- whether you use PROC REG, PROC GLM, PROC FREQ or PROC MEANS, etc. On the other hand, if you plan to use PROC REPORT, PROC PRINT or PROC TABULATE then your code could be more complex -- let's say you like the ANALYSIS style but feel that your results need a bit more pink and purple in the headers, then you could potentially do something like this:

ods html file='c:\temp\pinkpurple.html' style=analysis;

   proc print data=sashelp.class noobs

        style(header)={background=pink foreground=purple};

   run;

ods html close;

In this program, the overall ANALYSIS style will be used for most of the output, except for the column headers, because the STYLE= statement level option will override the information in the ANALYSIS with PINK for the header cell background color and PURPLE for the header cell foreground color.

Without knowing more about your procedure(s) of choice or how you are going to write your SAS/ODS code it is difficult to come up with more examples. There are a lot of good examples on the support.sas.com web site and in various user group papers...doing a google search on SAS ODS STYLE STYLE= should provide you with more examples.

cynthia

PMroz
Fluorite | Level 6

My needs are fairly simple.  I'm doing all of my analysis in JMP, and then I simply want to create "nice-looking" tabular output in an RTF file.  I guess I need to explore the PROC PRINT, PROC REPORT and PROC TABULATE programs. 

The JMP-SAS integration provides several options to facilitate ODS output. Here's a simple example:

SAS Connect();

SAS Export Data( Open( "$SAMPLE_DATA\Big Class.jmp" ), "WORK", "BIGCLASS" );

SAS Submit(

      "proc print data=work.bigclass; run;",

      ods( 1 ),

      ODSformat( "RTF" ),

      ODSStyle( "ANALYSIS" ),

      OpenODSResults( 1 ),

      title( "Big Class Output" )

);

SAS Get Output();

This program produces the following output (only a partial listing is shown)

Obs

name

age

sex

height

weight

1

KATIE

12

F

59

95

2

LOUISE

12

F

61

123

3

JANE

12

F

55

74

4

JACLYN

12

F

66

145

5

LILLIE

12

F

52

64

6

TIM

12

M

60

84

7

JAMES

12

M

61

128

8

ROBERT

12

M

51

79

9

BARBARA

13

F

60

112

10

ALICE

13

F

61

107

Cynthia_sas
SAS Super FREQ

Hi,

  Thanks for the example.

  If you are going for publication quality tables, you might want something less colorful than the ANALYSIS style, in which case, for RTF, I find that the JOURNAL style looks very professional. To alter your code to use this style, you would change just one line:

      ODSStyle( "JOURNAL" ),    (which is all black and white, with minimal interior lines)

OR, you might just like the default RTF style:

   ODSStyle( "RTF" ),         (which is black, white and gray with table lines)

If you were going to change PROC PRINT to use one of these styles, but to have different header fonts, for example, you would:

SAS Connect();

SAS Export Data( Open( "$SAMPLE_DATA\Big Class.jmp" ), "WORK", "BIGCLASS" );

SAS Submit(
      "proc print data=work.bigclass style(header)={font_face='Courier New'}; run;",
      ods( 1 ),
      ODSformat( "RTF" ),
      ODSStyle( "JOURNAL" ),
      OpenODSResults( 1 ),
      title( "Big Class Output" )
);

SAS Get Output();

I'm not exactly sure on how big the program in the Submit block can be, but I figure that it can use multiple lines in the submit, as long as the quotes are in place. Using ODS STYLE= overrides can create some lengthy code -- but here's a TABULATE example that uses JOURNAL style and changes the font to Courier New for selected pieces of the report:

SAS Connect();

SAS Export Data( Open( "$SAMPLE_DATA\Big Class.jmp" ), "WORK", "BIGCLASS" );

SAS Submit(
      "proc tabulate data=work.bigclass f=comma6.1
            style={font_face='Courier New'};
         class age / style={font_face='Courier New' font_weight=bold};
         var height weight / style={font_face='Courier New' font_weight=bold};
         table age all,
               mean*(height weight);
       run;",
      ods( 1 ),
      ODSformat( "RTF" ),
      ODSStyle( "JOURNAL" ),
      OpenODSResults( 1 ),
      title( "Big Class Output" )
);

SAS Get Output();

Based on how your version of the ANALYSIS style looks, I wonder what version of SAS you are running. The look of the ANALYSIS style changed between SAS 8 and SAS 9. I think that JOURNAL style was available in SAS 8, but I'm not sure; I know that the RTF style is available if you are running SAS 8. To see what the ANALYSIS style looks like with ODS RTF using SAS 9.3, see the attached screen shot.

cynthia


analysis93.jpg
PMroz
Fluorite | Level 6

Cynthia,

Thank you so much for your help/suggestions!  I'm running JMP 9.0.2 together with PC SAS 9.1.  The Journal style might do the trick.  Now if I can only please my pesky users...

I took a look at all available styles using this program:

SAS Connect();

SAS Submit(

"*ODS_Style_Output.sas -- program to create examples of all SAS ODS styles;

*modified by Elizabeth A. Swoope, Louisiana State University;

*source of original program lost;

*found at sastips.com, which is no longer a SAS web site;

filename list catalog 'work.temp.temp.source' ;

proc printto print=list new ;

proc template ;

     list styles ;

run ;

proc printto ;

data _null_ ; 

     length style $ 17 ;

     infile list missover ;

     input @'Styles.' style ;

     if style>' ' ;

     

      * create a folder for the files, then change the drive/folder below;

     call execute('ods rtf file=\!"c:\ODS_test\'||strip(style)||'.rtf\!" style='||style||';') ;

     call execute('title \!"'||style||'\!";') ;

     call execute('proc means data=sashelp.class maxdec=2; run ;') ;

     call execute('ods rtf close'||';') ;

run ;");

The code in the Submit block can be of unlimited size, btw.

Regards,

Peter

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1191 views
  • 3 likes
  • 2 in conversation