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

Hi,

I’m running SAS 9.1 on z/OS (MVS) and try to generate a report in MS Word The report have many elements both graphs and tables and will be sent to the users by email.


I can’t get graphs in the output document (instead of graphs I get just a line with some strange characters).

AsGraph.PNG

The table is fine but there are some strange characters on the top of the table as well.

topOfTable.PNG

I have no problem making PDF files (with graphs) but word documents seems not to be that easy?

Can anyone recommend a link to some useful papers about ODS and MS Word on mainframe (MVS)?

Here is my test code which I run in a JCL:
//......
//RTFFILE  DD DSN=XXXXXX,DISP=(NEW,CATLG,CATLG),
//            SPACE=(CYL,(1,3),RLSE),DATACLAS=DCMULTI,
//            DCB=(RECFM=VB,LRECL=8196,BLKSIZE=27998)
//G        DD DSN=XXXXX,DISP=(NEW,DELETE,DELETE),
//            SPACE=(CYL,(1,3),RLSE),DATACLAS=DCMULTI
//......


GOPTIONS RESET=ALL
         GSFMODE=REPLACE
         DEVICE=EMF
         GSFNAME=G
         ;

PROC GCHART DATA=SASHELP.CLASS;
VBAR SEX / NAME="TEST";
RUN;
QUIT:


OPTIONS ORIENTATION=LANDSCAPE;
ODS RTF FILE= RTFFILE STYLE=MINFONT RS=NONE TRANTAB=ASCII;

proc print data=sashelp.class noobs;
run;

proc greplay nofs
igout=Gseg;
replay test;
quit;


ODS RTF CLOSE;

and so:


FILENAME EMAIL EMAIL
TO=('.....

1 ACCEPTED SOLUTION

Accepted Solutions
alr
Quartz | Level 8 alr
Quartz | Level 8

Here comes the solution, thanks to SAS support and these articles: http://support.sas.com/rnd/base/ods/templateFAQ/ODS91.pdf and http://support.sas.com/rnd/base/ods/odsrtf/rtf-tips.pdf

The strange signs are because I run an old version of SAS (9.1).

The solution is:
1- to use NOTOC_DATA option
2- remove the TRANTAB
3- use CT="TEXT/PLAIN" EXT="DOC" when I send the report by email


ODS RTF FILE= RTFFILE RS=NONE NOTOC_DATA;
ODS LISTING CLOSE;

proc print data=sashelp.class noobs;
run;

GOPTIONS RESET=ALL
GSFMODE=REPLACE
DEVICE=EMF
GSFNAME=G
;

PROC GCHART DATA=SASHELP.CLASS;
VBAR SEX / NAME="TEST";
RUN;
QUIT:

ODS RTF CLOSE;

FILENAME EMAIL EMAIL
TO=(xx@xx.com'<mailto:xx@xx.com'>
)
FROM=('xx@xx.com'<mailto:'xx@xx.com'>)
SUBJECT = "Test file "
ATTACH = ("xxxxx.xxxx"
NAME="filnavn"
CT="TEXT/PLAIN" EXT="DOC")
;
RUN;

DATA _NULL_;
FILE EMAIL;
PUT "Here is your file. ";
RUN;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Well, a few things there.  You are not creating a Word document to start with.  You are creating an RTF file, which is a text markup language, i.e. it is plain text with many keywords to help the reader interpret and display the data.  What you are seeing between those curly braces is RTF code.  However it also looks incorrect.  RTF code is {} indicates a group, the keyword tc should be prefixed by \ slash: {\tc ...}.  The TC is normally for table of contents - you could try options(contents=no) on the ods rtf line.  You may also want to take off the options: STYLE=MINFONT RS=NONE TRANTAB=ASCII;

Thirdly how are you viewing the file as interpreters vary.

Finally have you tried running your code on Windows, and opening the file still in Windows with Word?  Not sure if there are limitations of graph drawing on your OS, also with regards to the output of said graph being embedded into the RTF.

alr
Quartz | Level 8 alr
Quartz | Level 8

Thank you.


contents=no made it even worst.

I’ve looked at this document http://support.sas.com/rnd/base/ods/templateFAQ/MVSODS3.pdf
But I guess our system is a bit different.

I’ll send the file to myself by email and open it in word.

FILENAME EMAIL EMAIL
TO=(xx@xx.com'
)
FROM=('xx@xx.com')
SUBJECT = "Test file "
ATTACH  = ("xxxxx.xxxx"
NAME="ZZZ"
CT="APPLICATION/MSWORD" EXT="DOC")
;
RUN;
DATA _NULL_;
FILE EMAIL;
PUT "Here is your file. ";
RUN;

The code works fine in PC SAS at windows. It works fine with ODS PDF on MVS as well.


Do you know any articles on how to create word documents with graphs on MVS?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, I don't and nothing seems to come up on a Google.  Perhaps try an IT ticket on this one as it looks to me a bit like the tagset is outputting something incorrectly.

alr
Quartz | Level 8 alr
Quartz | Level 8

Here comes the solution, thanks to SAS support and these articles: http://support.sas.com/rnd/base/ods/templateFAQ/ODS91.pdf and http://support.sas.com/rnd/base/ods/odsrtf/rtf-tips.pdf

The strange signs are because I run an old version of SAS (9.1).

The solution is:
1- to use NOTOC_DATA option
2- remove the TRANTAB
3- use CT="TEXT/PLAIN" EXT="DOC" when I send the report by email


ODS RTF FILE= RTFFILE RS=NONE NOTOC_DATA;
ODS LISTING CLOSE;

proc print data=sashelp.class noobs;
run;

GOPTIONS RESET=ALL
GSFMODE=REPLACE
DEVICE=EMF
GSFNAME=G
;

PROC GCHART DATA=SASHELP.CLASS;
VBAR SEX / NAME="TEST";
RUN;
QUIT:

ODS RTF CLOSE;

FILENAME EMAIL EMAIL
TO=(xx@xx.com'<mailto:xx@xx.com'>
)
FROM=('xx@xx.com'<mailto:'xx@xx.com'>)
SUBJECT = "Test file "
ATTACH = ("xxxxx.xxxx"
NAME="filnavn"
CT="TEXT/PLAIN" EXT="DOC")
;
RUN;

DATA _NULL_;
FILE EMAIL;
PUT "Here is your file. ";
RUN;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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