- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have a char column that is display different in SAS studio data viewer and printed results;
In data viewer, it shows many extra spaces between words, but if I print the variable, it looks fine.
In data viewer
Result from proc print:
Look at the space between "Master" and "vs". Could someone tell me why it's like this?
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I got it.
Extra spaces exist in data set and they can be removed by "compbl" function.
ODS html may automatically call "compbl" before printing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your problem is that you are using ODS to print your results. If you print to the normal text output you won't have that problem. Example:
data test;
input string $50.;
cards;
one two
one two
one two
one two
one two
;
proc print;
run;
Normal listing output:
Obs string 1 one two 2 one two 3 one two 4 one two 5 one two
Picture of what ODS produces:
Perhaps there is a STYLE option that will preserve the spaces between "words", but I could not find it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!
I use SAS Enterprise7.15.
When I print results to HTML format, the spaces will be removed. If I print to other formats, then spaces won't be removed
Html:
rtf:
It seems that the display is controlled by neither data format nor style sheet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Tom,
The STYLE option you are looking for is "ASIS=ON".
data test;
input string $50.;
cards;
one two
one two
one two
one two
one two
;
proc print style(column)={asis=on};
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I didnot know styles worked so different on different ODS destinations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I got it.
Extra spaces exist in data set and they can be removed by "compbl" function.
ODS html may automatically call "compbl" before printing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Smurf wrote:
I got it.
Extra spaces exist in data set and they can be removed by "compbl" function.
ODS html may automatically call "compbl" before printing.
If the goal is to remove the extra spaces then COMPBL() is a good choice. Be careful that some of that extra space are other invisible characters that COMPBL() will not remove. Such non-breaking space 'A0'x or tab '09'x.
It is not so much as HTML calling COMPBL() but just the nature of how HTML pages works. If you build an HTML page by hand it will flow text into neat paragraphs for you. If you want it to preserve white spaces you have to add extra code into the HTML.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content