- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I wanted to write a sas code which could have defined number of the cells(variables) in rtf report and the lengths of each cell. Could you please provide any recommendations/links.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When you have attributes details, variables with fixed length. you can read the input raw data with fixed column input.
example:
data x;
infile "filename.rtf";
input Name $ 1-20
DOB $ 21-31
Gender $ 32
Balance 33-40;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When you have attributes details, variables with fixed length.
That is the question - I have just file and do not know the lengths.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@DmytroYermak you need to post more details of what you’re trying to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
RTF files are for word processor text. You need to scan the rtf text for tags that indicate tabular data, and then try to extract the cell values from that.
The wikipedia article on the rtf file format will give you hints how hard this will be.
RTF files are even less suited for SAS data input than Excel files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@DmytroYermak wrote:
Thank you! Do you know "the tags that indicate tabular data"?
No. Best you can do is to create a rtf file with data as you expect it, and then inspect the contents of the file with a pure text editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For one shot deals, I can sometimes open the rtf file in Word, copy the material I want to the clipboard and then paste it into a raw text processor. Then read it from there with SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@PGStats wrote:
For one shot deals, I can sometimes open the rtf file in Word, copy the material I want to the clipboard and then paste it into a raw text processor. Then read it from there with SAS.
Or (shudders) paste into Excel. And save as CSV for import.