DATA Step, Macro, Functions and more

Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

Reply
Occasional Contributor
Posts: 11

Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

Dear All,

 

Requesting you please help me with the below query.

 

I am trying to create the patient Narrative in RTF format .  I can able to write eveything using proc stream in patient narative RTF doc but I am not able to include the table in RTF document. The table is getting created using ODS and the using in proc stream to include that table in narrative.

 

In HTML format , table is coming properly but when tried with RTF , something different lines are coming instead of table . Please find the attached doc.

 

If anyone have any idea or faced this kind of issue earlier then please help me.

 

Thanks . 

Super User
Posts: 13,293

Re: Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

It would help if you showed code that you used and example data. Dummy data is fine as long as it will replicate the issue you have.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

 

Occasional Contributor
Posts: 11

Re: Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

Hi  Ballardw,

 

Please find the attached code to write/copy the table in patient narative document getting create using proc stream in RTF format. I have attached code, Narative_sampleN.rtf and word doc which content  patient narration (in RTF Format) which will be before writting the table in narration doc. I am able to write content of all different sections using SAS macro  but at the end of this  i wanted to copy/wrirte table using same proc stream but when i am trying it then instead of table , it is displaying some RTF lines describing table which needs to be handled.

 

attached Narrative_SampleN.rtf is output of my code in which i am trying to write table in RTF file using proc stream . Note that, before table there would be patient narration which is display in my third attachement. Only table i am not able to write/copy into my narrative RTF file.

 

please assist.

Valued Guide
Posts: 570

Re: Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

If I understand correctly what you want to do is write a stream of text followed by a rendering of a SAS data set to an RTF file. The reason your Proc Stream isn't working as you expect is because it is designed to process text and macro code only. I think the best way to do this is to use the ODS Document destination to print the text (using Proc Stream if you wish) followed by a Proc Print for the table. You can then use Proc Document to write all of that to an RTF file.

 

If you give us some sample code for your Proc Stream reading your text I can supply more details but it's a bit difficult for me to give you code otherwise.

Occasional Contributor
Posts: 11

Re: Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

Posted in reply to ChrisBrooks

Hi Chris,

 

Thank you for quick reply.

 

I have attached wroge code in my last post. Please find the sample code where i am trying to write/copy table in RTF document creating using proc stream.

 

I have also again attached output (Narrative_sampleN.rtf) created using same code and in third attachment , i have provided the contents that i am writting to my narrative document. Header, narrative introduction... etc using SAS macros.

 

In Narrative_sample.rtf, Instead of table , it is coming some different lines describing my table.

 

Could you please help me here.  I hope , the attached files would be useful to you for giving assistance to handle this scenario.

 

 

Occasional Contributor
Posts: 11

Re: Writing/Copying Table created using ODS into patient narrative creating in RTF using proc stream

Posted in reply to ChrisBrooks

 Hi ChrisBrooks,

 

I tried to write text by resolving the macro variables followed by table to create RTF document which should contain all text and table but not able to create file.

 

Could you please help me with the approach how can we write text from macro variables followed by SAS table in RTF file using ODS Document & Proc Document .?  Please let me know in case if you require any more details.

 

 

Ask a Question
Discussion stats
  • 5 replies
  • 125 views
  • 1 like
  • 3 in conversation