SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Yurie
Fluorite | Level 6

I have a text variable like the following. How can I extract the useful information that I need? Thanks.

 

{\rtf1\ansi\ansicpg1252\uc0\deff1{\fonttbl {\f0\fswiss\fcharset0\fprq2 Arial;} {\f1\froman\fcharset0\fprq2 Times New Roman;} {\f2\froman\fcharset2\fprq2 Symbol;}} {\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red255\green0\blue0;} {\stylesheet{\s0\f1\fs20 Normal;}{\*\cs10\additive Default Paragraph Font;}{\s16\f0\fs24 [Normal];}{\s17\sa120\f1\fs20\sbasedon0 Body Text;}{\s18\qc\sb360\sa240\f0\fs20\b\sbasedon0\snext0 heading 1;}} {\*\listtable{\list\listtemplateid1\listsimple{\listlevel\levelnfc0\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00\'2e;}{\levelnumbers\'01;}\f1\fs24\b0\i0\strike0\ul0\cf0\cb0\fi-360\li821}{\listname ;}\listid1}} {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} {\*\generator TX_RTF32 9.1.312.500;} \deftab1134\paperw12240\paperh15840\margl2592\margt3888\margr1138\margb1138\pard\s17\sl480\slmult1\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\tx9360\tx10080\plain\f1\fs24\cf3 <CERTIFIED MAIL #> <HAND DELIVERY> \par\pard\s17\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\tx9360\tx10080\plain\f1\fs24 [Today in Words()]\par\par [Admin. 1st Name (Frank)()] [Admin. Last name (Smith)()], Administrator\parhe facility received an \loch\f1\hich\f1 \'93A\'94 during its survey,...

 

6 REPLIES 6
ballardw
Super User

If you mean something other than the RTF codes best might be to save the file as plain Text and remove all of the formatting and appearance information.

Then read the resulting text file.

Yurie
Fluorite | Level 6

Thanks. I saved it in .rtf (word document). However, I do not know how to remove those strange symbols and letters. When I open the file, those rtf codes are still there. Any suggestions will greatly appreciated. 

Reeza
Super User

Save as txt instead of RTF. 

ballardw
Super User

RTF is not plain text as you see.

Yurie
Fluorite | Level 6

Thanks. I tried to save it as .txt file. When I open it again, it shows extactly what I save there. I am wondering do I need some code to extract the right informaiton, or anyting else? 

Reeza
Super User

You opened rhe file in Word and then saved as a txt file? That should have stripped the RTF tags. 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2048 views
  • 0 likes
  • 3 in conversation