BookmarkSubscribeRSS Feed
ThomasH
Calcite | Level 5
Hi all,

since upgrading to DI Studio 4.21 the output contains some leading spaces, which is really annoying sometimes. So instead of this:


Obs zeile

1 total 1188
2 -rw-rw-r-- 1 abc sasuser 235175 Mar 29 17:00 AC33005EX_ExtraktSomething.sas

it looks like this

Obs zeile

space space space space 1 total 1188
space space space space 2 -rw-rw-r-- 1 abc sasuser 235175 Mar 29 17:00 AC33005EX_ExtraktSomethi
ng.sas

(and the file name is split into 2 rows)

Why would that happen and can I change it via some setting?

Thanks a lot!

Thomas

Message was edited by: ThomasH Message was edited by: ThomasH
7 REPLIES 7
Halaku
Obsidian | Level 7
Please specify the column lengths where the data is coming from. From what I see it looks like you require a TRIM function:

TRIM(column1) || ' ' || TRIM(column2) || ' ' || TRIM(column3)

SAS suggests to use the functions otherwise SAS takes the full length of the column by pedding the white space.

Hope that helps.

Misbah.
ThomasH
Calcite | Level 5
Hi Misbah,

actually I am talking about the output tab in DI Studio, that display e.g. a

proc print data=work.W5LUMTKV;
run;

I cant trim that one and still it also starts with the column names like 20 spaces to the right.

Thomas
Patrick
Opal | Level 21
Hi Thomas

Is it now...

Obs zeile

space space space space 1 total 1188
space space space space 2 -rw-rw-r-- 1 abc sasuser 235175 Mar 29 17:00 AC33005EX_ExtraktSomethi

...as the example you've given or is it:

space space space space Obs zeile

space space space space 1 total 1188
space space space space 2 -rw-rw-r-- 1 abc sasuser 235175 Mar 29 17:00 AC33005EX_ExtraktSomethi

...as your narrative implies.


If first is the case then I would assume that the values in variable "Zeile" have leading blanks. If so then the easiest way to avoid issues would be to use informat $w. instead of $CHARw. and all the pain should go away.

I also found this link: http://support.sas.com/kb/23/332.html
So if you're using ODS then probabely the underlying style definition has changed to ASIS=ON as part of the SAS9.2 implementation (someone customized the style).


If also the variable headings are not left aligned then I would assume that alignment options have been changed (i.e. the leftmargin option). Run a proc options statement and check what settings there are - and if they are still the same than in the old environment.
Again: If you're using ODS then also changes in the underlying style could mess-up your output.


Let us know how you go.

HTH
Patrick
thomash123
Calcite | Level 5
Hi,

it is actually like in your second example - I missed the spaces in the header in my first post.

So I checked proc options and all margins - especially leftmargin - are like "0.0000 IN".

No ODS in use.

Cheers,
Thomas
Patrick
Opal | Level 21
Hi Thomas

Looking at the code the "List Data" transformation generates in DIS4.21 you're actually using ODS LISTING.

%else %do;
ODS listing;
%end;


I've run the following code in my very default SAS9.2 installation...

ods listing ;
proc print data=sashelp.air;
run;
ods listing close;

... and got a result in the listing output similar to what you're describing.


But when using option "NOCENTER" my output suddenly was left-aligned.

My assumption is:
The SAS default installation setting for SAS9.2 is "CENTER". In your previous environment the option was set to "NOCENTER".

You could ask your SAS Admin to set "NOCENTER" as default as it was before - or you set the option yourself in the "List Data" transformation under "options/Other options/System options" - or even as job pre-code.

HTH
Patrick
thomash123
Calcite | Level 5
Hi Patrick,

thanks for the reply. I am not using the list data transformation, but some self generated code.

However, the "options nocenter" thing works. I should have a close look at all the options one can set - is there an exhaustive list somewhere?

Thanks a lot!
Thomas
nar_sas
SAS Employee
This is not really a DI Studio issue, it is more of a base SAS issue and can be controlled via proc print options. You can find the online doc here, and a search for proc print revealed lots of related information:

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000064126.htm

The discussion on column width may answer the question:

Column Width
By default, PROC PRINT uses a variable's formatted width as the column width. (The WIDTH= option overrides this default behavior.) If the variable does not have a format that explicitly specifies a field width, PROC PRINT uses the widest data value for that variable on that page as the column width.

If the formatted value of a character variable or the data width of an unformatted character variable exceeds the line size minus the length of all the ID variables, PROC PRINT might truncate the value. Consider the following situation:

The line size is 80.

IdNumber is a character variable with a length of 10. It is used as an ID variable.

State is a character variable with a length of 2. It is used as an ID variable.

Comment is a character variable with a length of 200.

When PROC PRINT prints these three variables on a line, it uses 14 print positions for the two ID variables and the space after each one. This arrangement leaves 80-14, or 66, print positions for COMMENT. Longer values of COMMENT are truncated.

WIDTH= controls the column width.

Note: Column width is affected not only by variable width but also by the length of column headings. Long column headings might lessen the usefulness of WIDTH=.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1924 views
  • 0 likes
  • 5 in conversation