BookmarkSubscribeRSS Feed
Ashish_S
Fluorite | Level 6

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 . 

5 REPLIES 5
ballardw
Super User

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.

 

 

Ashish_S
Fluorite | Level 6

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.

ChrisBrooks
Ammonite | Level 13

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.

Ashish_S
Fluorite | Level 6

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.

 

 

Ashish_S
Fluorite | Level 6

 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.

 

 

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
  • 5 replies
  • 2241 views
  • 1 like
  • 3 in conversation