Discussion:
Keeping trailing zeros in SAS Results viewer,
(too old to reply)
Brian Wallace
2009-09-02 22:20:14 UTC
Permalink
A few questions. All of them pretty simple and stupid, I guess. It's tough being the only SAS programmer in a company of three hundred, though.

I have a field with a a value: 0.570

Using PC SAS, when printed to the output window it's 0.570.

When output to a pdf file it's 0.570

However, viewing the SAS data set in the old SAS System Viewer, the new SAS Universal Viewer and viewing it as a table from the "Results" window, it gives me: 0.57

I working with a client who can only view the delivered data set through a SAS viewer and when HE looks at the field he is saying "That's only to two decimal points of precision, we asked for three." I may have even asked this before. Is there any way you can retain the trailing zeroes in the various SAS viewers? I know that SAS sees 0.570 and 0.57 as the exact same thing but that doesn't help me.

When dealing with a SAS data set you can view it in different ways. Is the output window the "truest" version of the data set? The Results Table view is just a glorified SAS viewer, right?

Formating doesn't help and I thought I could write a picture format but '0000.009' creates a mess.

Any help would be appreciated. Thanks in advance.

Two unrelated questions:

1.) Are there some formats that the SAS Universal Viewer will display but the SAS System viewer will not? I'm specifically thinking of the ISO CDISC formats.

2.) Is this a true statement: If you are reading in numeric values, some with decimal points and some without, using a .d for the informat value is just asking for trouble since SAS will ignore it. Will SAS ignore it record by record or only if the first value it reads has a decimel?

Very sorry for all of the questions. Most probably don't make sense. Stressful day. I hope everyone is well.

Thank you,

Brian Wallace
Joe Matise
2009-09-02 22:38:04 UTC
Permalink
1. Whack your client upside the head with a stick.

If that doesn't work, then move on to the following:

* What version of SAS? I just ran the following code:
data test;
input x;
format x 8.3;
datalines;
0.57
0.571
0.570
0.57787
;
run;
in 9.1.3 and 9.2 TSM2, and when I open it from the Explorer window [I assume
that's what you mean by 'results window'?] it looks fine [ie, I always see
.570 for lines 1 and 3]. However, in Universal Viewer 9.2 it loses its
format for some reason [it shows up with no format]. I don't use UV so
don't know if that's a bug or what.

What's even funnier is when I do this:

proc format lib=work;
picture threedec
low- -1 = 00000.009
-1 <-< 0 = 9.009 (prefix='-')
0 - < 1 = 9.009
1 - high = 00000.009
;
quit;

and use it in the previous bit, SAS UV 9.2 sees the format, and thinks it's
using it... but it doesn't use it. My vote is 'SAS UV is buggy and useless'
here.

In terms of what to do with your client - print it in PDF or deliver it in
Excel/Access/DBF or something where you can control what he sees. Or revert
to the stick method, works well for me I've found ;)

-Joe
Post by Brian Wallace
A few questions. All of them pretty simple and stupid, I guess. It's
tough being the only SAS programmer in a company of three hundred, though.
I have a field with a a value: 0.570
Using PC SAS, when printed to the output window it's 0.570.
When output to a pdf file it's 0.570
However, viewing the SAS data set in the old SAS System Viewer, the new SAS
Universal Viewer and viewing it as a table from the "Results" window, it
gives me: 0.57
I working with a client who can only view the delivered data set through a
SAS viewer and when HE looks at the field he is saying "That's only to two
decimal points of precision, we asked for three." I may have even asked
this before. Is there any way you can retain the trailing zeroes in the
various SAS viewers? I know that SAS sees 0.570 and 0.57 as the exact same
thing but that doesn't help me.
When dealing with a SAS data set you can view it in different ways. Is the
output window the "truest" version of the data set? The Results Table view
is just a glorified SAS viewer, right?
Formating doesn't help and I thought I could write a picture format but
'0000.009' creates a mess.
Any help would be appreciated. Thanks in advance.
1.) Are there some formats that the SAS Universal Viewer will display but
the SAS System viewer will not? I'm specifically thinking of the ISO CDISC
formats.
2.) Is this a true statement: If you are reading in numeric values, some
with decimal points and some without, using a .d for the informat value is
just asking for trouble since SAS will ignore it. Will SAS ignore it record
by record or only if the first value it reads has a decimel?
Very sorry for all of the questions. Most probably don't make sense.
Stressful day. I hope everyone is well.
Thank you,
Brian Wallace
Arthur Tabachneck
2009-09-02 23:16:20 UTC
Permalink
Brian,

I don't have either viewer installed, thus can't test the following:

Viewing SAS Data Sets
SAS applies a format to the data by default. If you want to change the table
default, select ToolsOptions from the menu. Then click the Formats tab. The
check box on this tab works as a toggle. Check the box to change the
default.

Hopefully, that makes sense and, better yet, offers a solution.

Art
--------
Post by Brian Wallace
A few questions. All of them pretty simple and stupid, I guess. It's
tough being the only SAS programmer in a company of three hundred, though.
Post by Brian Wallace
I have a field with a a value: 0.570
Using PC SAS, when printed to the output window it's 0.570.
When output to a pdf file it's 0.570
However, viewing the SAS data set in the old SAS System Viewer, the new SAS
Universal Viewer and viewing it as a table from the "Results" window, it
gives me: 0.57
Post by Brian Wallace
I working with a client who can only view the delivered data set through a
SAS viewer and when HE looks at the field he is saying "That's only to two
decimal points of precision, we asked for three." I may have even asked
this before. Is there any way you can retain the trailing zeroes in the
various SAS viewers? I know that SAS sees 0.570 and 0.57 as the exact same
thing but that doesn't help me.
Post by Brian Wallace
When dealing with a SAS data set you can view it in different ways. Is the
output window the "truest" version of the data set? The Results Table view
is just a glorified SAS viewer, right?
Post by Brian Wallace
Formating doesn't help and I thought I could write a picture format but
'0000.009' creates a mess.
Post by Brian Wallace
Any help would be appreciated. Thanks in advance.
1.) Are there some formats that the SAS Universal Viewer will display but
the SAS System viewer will not? I'm specifically thinking of the ISO CDISC
formats.
Post by Brian Wallace
2.) Is this a true statement: If you are reading in numeric values, some
with decimal points and some without, using a .d for the informat value is
just asking for trouble since SAS will ignore it. Will SAS ignore it record
by record or only if the first value it reads has a decimel?
Post by Brian Wallace
Very sorry for all of the questions. Most probably don't make sense.
Stressful day. I hope everyone is well.
Post by Brian Wallace
Thank you,
Brian Wallace
Lou
2009-09-03 14:15:50 UTC
Permalink
Post by Brian Wallace
A few questions. All of them pretty simple and stupid, I guess. It's
tough being the only SAS programmer in a company of three hundred, though.
Post by Brian Wallace
I have a field with a a value: 0.570
Using PC SAS, when printed to the output window it's 0.570.
When output to a pdf file it's 0.570
However, viewing the SAS data set in the old SAS System Viewer, the new
SAS Universal Viewer and viewing it as a table from the "Results" window, it
gives me: 0.57
Post by Brian Wallace
I working with a client who can only view the delivered data set through a
SAS viewer and when HE looks at the field he is saying "That's only to two
decimal points of precision, we asked for three." I may have even asked
this before. Is there any way you can retain the trailing zeroes in the
various SAS viewers? I know that SAS sees 0.570 and 0.57 as the exact same
thing but that doesn't help me.
Post by Brian Wallace
When dealing with a SAS data set you can view it in different ways. Is
the output window the "truest" version of the data set? The Results Table
view is just a glorified SAS viewer, right?
Post by Brian Wallace
Formating doesn't help and I thought I could write a picture format but
'0000.009' creates a mess.
Post by Brian Wallace
Any help would be appreciated. Thanks in advance.
1.) Are there some formats that the SAS Universal Viewer will display but
the SAS System viewer will not? I'm specifically thinking of the ISO CDISC
formats.
Post by Brian Wallace
2.) Is this a true statement: If you are reading in numeric values, some
with decimal points and some without, using a .d for the informat value is
just asking for trouble since SAS will ignore it. Will SAS ignore it record
by record or only if the first value it reads has a decimel?

This is a false statement. When using the W.D informat:

If a decimal point is not included in the input field, the value read in is
divided by 10 to the Dth power. For examaple, if the informat is 5.2, the
value is divided by 10 to the 2 (in other words, by 100).

If a decimal point is included in the input field, the decimal point is part
of the value, and the .D part of the specification is ignored

These rules are obeyed for every VALUE read in, whether it's one or multiple
values per input record. Try running the following code and check the
result.

data fee;
input fie 5.2;
cards;
5
5.000
50.00
500.0
50000
;
run;
Post by Brian Wallace
Very sorry for all of the questions. Most probably don't make sense.
Stressful day. I hope everyone is well.
Post by Brian Wallace
Thank you,
Brian Wallace
Randy Herbison
2009-09-04 18:00:49 UTC
Permalink
Brian,

As Joe wrote, you can assign a w.d format and the Viewtable window (default viewer when you open a data set via the SAS Explorer) will use it:

data test;
input x;
format x 5.3;
datalines;
0.57
0.571
0.570
0.57787
;

Viewtable displays x with 3 decimal places, but the Universal Viewer 1.0 will use the best. format. To get the Universal Viewer to display the value of x with 3 decimal places, use the alias for the w.d format: fw.d

data test;
input x;
format x f5.3;
datalines;
0.57
0.571
0.570
0.57787
;

I suspect that SAS did not intend for the Universal Viewer to treat w.d and fw.d differently.

-Randy




-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-***@LISTSERV.UGA.EDU] On Behalf Of Brian Wallace
Sent: Wednesday, September 02, 2009 6:20 PM
To: SAS-***@LISTSERV.UGA.EDU
Subject: Keeping trailing zeros in SAS Results viewer, SAS system viewer and SAS universal viewer.

A few questions. All of them pretty simple and stupid, I guess. It's tough being the only SAS programmer in a company of three hundred, though.

I have a field with a a value: 0.570

Using PC SAS, when printed to the output window it's 0.570.

When output to a pdf file it's 0.570

However, viewing the SAS data set in the old SAS System Viewer, the new SAS Universal Viewer and viewing it as a table from the "Results" window, it gives me: 0.57

I working with a client who can only view the delivered data set through a SAS viewer and when HE looks at the field he is saying "That's only to two decimal points of precision, we asked for three." I may have even asked this before. Is there any way you can retain the trailing zeroes in the various SAS viewers? I know that SAS sees 0.570 and 0.57 as the exact same thing but that doesn't help me.

When dealing with a SAS data set you can view it in different ways. Is the output window the "truest" version of the data set? The Results Table view is just a glorified SAS viewer, right?

Formating doesn't help and I thought I could write a picture format but '0000.009' creates a mess.

Any help would be appreciated. Thanks in advance.

Two unrelated questions:

1.) Are there some formats that the SAS Universal Viewer will display but the SAS System viewer will not? I'm specifically thinking of the ISO CDISC formats.

2.) Is this a true statement: If you are reading in numeric values, some with decimal points and some without, using a .d for the informat value is just asking for trouble since SAS will ignore it. Will SAS ignore it record by record or only if the first value it reads has a decimel?

Very sorry for all of the questions. Most probably don't make sense. Stressful day. I hope everyone is well.

Thank you,

Brian Wallace

Loading...