DATA Step, Macro, Functions and more

Precision Issue in the Listings

Reply
New Contributor
Posts: 3

Precision Issue in the Listings

Hi,

I have been working on the listings and I see an issue with the justification of one of test results when precision of 7 is used.

Imagine the data for test results is as follows:

 

20.000

30.000

40.000

 

Output expected is :

20

30

40

 

Good news is output is as expected but not center justified. The following is the code used in Proc Report.

 

define xxx / center flow "xxx Dose "
style(column)=[cellwidth=6% asis=on]
style(header)=[just=center] format=7.0;

 

Is there an alternative where the data can be displayed in the center as the expected output?

Thanks in advance.

 

Regards,

RupaM

Super User
Posts: 24,012

Re: Precision Issue in the Listings

Works fine for me with this example:

 

proc report data=sashelp.class nowd;
column name age weight;
define name /display;
define age / center display 'Age (yrs)';
define weight / right format=8.1;
run;

You'll need to provide more information to illustrate how this is not working for you.

 


@RupaM3 wrote:

Hi,

I have been working on the listings and I see an issue with the justification of one of test results when precision of 7 is used.

Imagine the data for test results is as follows:

 

20.000

30.000

40.000

 

Output expected is :

20

30

40

 

Good news is output is as expected but not center justified. The following is the code used in Proc Report.

 

define xxx / center flow "xxx Dose "
style(column)=[cellwidth=6% asis=on]
style(header)=[just=center] format=7.0;

 

Is there an alternative where the data can be displayed in the center as the expected output?

Thanks in advance.

 

Regards,

RupaM


 

New Contributor
Posts: 3

Re: Precision Issue in the Listings_with screenshots attached

Hi Reeza,

 

The data gets wrapped and the output is not center justified. Is this commonly expected? 

I have attached the screenshots of two conditions where Format wasn't applied and was applied.

Hope this helps.

Thanks,

 

Regards,

Rupa

 

 

SAS Super FREQ
Posts: 9,433

Re: Precision Issue in the Listings_with screenshots attached

[ Edited ]

Hi: Please show ALL your code. Your output looks like RTF output with the JOURNAL style, but you do NOT show any RTF statements. And, without any DATA to use, it is impossible to replicate your results or try to see what you mean. You do NOT show your COLUMN statement and you seem to have the wrong idea about what goes in the DEFINE statement.

You have this:
define xxx / center flow "xxx Dose "
style(column)=[cellwidth=6% asis=on]
style(header)=[just=center] format=7.0;

CENTER and FLOW are LISTING only options. If you want the data cell values to be centered, I recommend against using the CENTER option here. I don't understand, based on the data you show, why you are using the FLOW option, at all. That is a LISTING only option and irrelevant for any destination that uses STYLE options.

 

However, the HEADER is just the string 'xxx Dose' and the column is the for the formatted data value -- why do you have ASIS=ON for the data column? Are you using the SPLIT= option in PROC REPORT to get the headers like Actual Time split on 2 lines? If you are trying to force the text string to split using cellwidth, this is the wrong technique.

 

  If you want the numbers in the data cells centered, you need to ALSO move just=c into the style override for the COLUMN too. Also, why are you specifying a % for cellwidth? That will force RTF to convert from percent to TWIPS (twentieths of a printer's point) which is less reliable that specifying the size in inches or centimeters or just leave it off and see what you get before you start fiddling with settings. I doubt you need ASIS=ON and you probably don't need the CELLWIDTH either.

Seeing ALL your code and having some test data would be the best way to enable others to help you.

Cynthia

 

Using this code, without FLOW or ASIS=ON or CELLWIDTH, I get centering for both the header and the data cells:

center_data_values.png

Ask a Question
Discussion stats
  • 3 replies
  • 96 views
  • 0 likes
  • 3 in conversation