BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SteveDenham
Jade | Level 19

i feel like I am getting the hang of this now, but I have a question about the Est datasets produced.  The last column has Name: Pr, Label: Pr > ChiSq and Format PVALUE6.  However, when viewed in the Enhanced Editor  the displayed value in the dataset is a single numeric, either 0 or 1.  No problem in EG.  I would like to   know a good way to get the variable in the dataset to display in conformance with the format in my default/preferred editor.  Or is this something I should report as a bug?

 

SteveDenham

 

(Yeah, yeah, I know I should just change my environment to something from the 21st century, but like I was going to say above, I am a lazy kind of guy)

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

@SteveDenham wrote:

(...) The last column has Name: Pr, Label: Pr > ChiSq and Format PVALUE6.  However, when viewed in the Enhanced Editor  the displayed value in the dataset is a single numeric, either 0 or 1.


It seems that the Viewtable window (which I assume you are using) doesn't recognize the default value for d in the PVALUEw.d format. From the documentation:

d

specifies the number of digits to the right of the decimal point in the numeric value. This argument is optional.

Default the minimum of 4 and w–2

 

So, PVALUE6. is actually equivalent to PVALUE6.4. As @Rick_SAS has suggested, you can change pvalue6. to pvalue6.4 -- it's in line 749 of macro NLEST, current version 1.8:

           format Pr pvalue6.4;

At least this works with my test dataset:

data test;
do k=0 to 8;
  P  = 10**-k;
  Pr = P;
  output;
end;
format P pvalue6. Pr pvalue6.4;
run;

Viewtable:

pv_viewtable.png

The SAS Universal Viewer (my preferred tool for viewing datasets) does not have this issue (and you can even toggle between formatted and unformatted values, see screenshot below):

pv_UniViewer.png

 

View solution in original post

7 REPLIES 7
Rick_SAS
SAS Super FREQ

I think the correct format should be PVALUE6.4, not PVALUE6. Use PROC CONTENTS to make sure you typed the correct format.

 

Run this program and open the data set in your SAS Windowing environment. Let me know if you still see the problem:

data EstTest;
format Pr PVALUE6.4;
label Pr = "Pr > ChiSq";
input Pr @@;
Raw = Pr;
datalines;
0.99 0.1 0.05 0.098 0.0054 0.00019 3.21E-5 1.23E-6
;

If you can see the EstTest data correctly, and if your data really is using PVALUE6., then this is a bug.

If this is a SAS-supported macro, make sure you are using the most recent version.

 

Report back what you observe. If this is a bug, I will alert Tech Support, who will make sure the problem gets fixed.

 

FreelanceReinh
Jade | Level 19

@SteveDenham wrote:

(...) The last column has Name: Pr, Label: Pr > ChiSq and Format PVALUE6.  However, when viewed in the Enhanced Editor  the displayed value in the dataset is a single numeric, either 0 or 1.


It seems that the Viewtable window (which I assume you are using) doesn't recognize the default value for d in the PVALUEw.d format. From the documentation:

d

specifies the number of digits to the right of the decimal point in the numeric value. This argument is optional.

Default the minimum of 4 and w–2

 

So, PVALUE6. is actually equivalent to PVALUE6.4. As @Rick_SAS has suggested, you can change pvalue6. to pvalue6.4 -- it's in line 749 of macro NLEST, current version 1.8:

           format Pr pvalue6.4;

At least this works with my test dataset:

data test;
do k=0 to 8;
  P  = 10**-k;
  Pr = P;
  output;
end;
format P pvalue6. Pr pvalue6.4;
run;

Viewtable:

pv_viewtable.png

The SAS Universal Viewer (my preferred tool for viewing datasets) does not have this issue (and you can even toggle between formatted and unformatted values, see screenshot below):

pv_UniViewer.png

 

StatDave
SAS Super FREQ

The PVALUE6. format used by the macros is okay as is. You probably just have p-values that all round to either 0 or 1 when displayed to 4 decimal places. If you want, print the data set using format 10.8 to see the values to more precision.

Rick_SAS
SAS Super FREQ

@StatDave I respectfully disagree. I can reproduce Steve's observations by using the program that I wrote, but change the FORMAT statement to

format Pr PVALUE6.;

 

If you run my program in the old SAS Windowing Environment on Windows and then click on the EstTest icon in the Results window to open it in the old VIEWTABLE application, you will see that Steve's comments are correct. The ViewTable only displays 1 or 0 when the format is PVALUE6.  If you change the format to PVALUE6.4, then the ViewTable displays the formatted values correctly.

 

Steve, the ViewTable isn't being developed or shipped anymore, so we can't fix the bug there. But maybe Dave knows how to get PVALUE6.4 added to the macro.

ballardw
Super User

I suspect the Viewtable issue may be related to the programming of "default" formats. There is drop down list for formats and informats when you look at column properties from Viewtable by clicking on the column header. PVALUE is not one of the formats in the list, so the expected behavior of displaying 4 decimals wasn't set up by the widget programmer. I think that Pvalue may be the only format that displays decimals by default in other output. So the exception got missed in Viewtable.

Rick_SAS
SAS Super FREQ

Or the ViewTable is so old that the PVALUEw.d format wasn't invented yet! 🙂

SteveDenham
Jade | Level 19

From my log, it appears that the version of VIEWTABLE was shipped with:

 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M6)
      Licensed to CHARLES RIVER LABORATORIES INTERNATIONAL INC, Site 70272434.
NOTE: This session is executing on the X64_10PRO  platform.



NOTE: Analytical products:

      SAS/STAT 15.1
      SAS/ETS 15.1
      SAS/IML 15.1
      SAS/QC 15.1

NOTE: Additional host information:

 X64_10PRO WIN 10.0.19041  Workstation

My copy of EG accesses the same installation, but viewing the datasets there accommodates PVALUE6. 

 

SASViewer 9.1 does not format the p value - it looks like it is either BEST12. or 12.10  UniViewer toggles between PVALUE6. and Unformatted (likely BEST12.)

 

And the Results window displays the value, as does a PROC PRINT.

 

The Pvalue6. format rounds to a single digit in my version of TABLEVIEW.  Values less than 0.5 are presented as 0, greater than or equal to 0.5 are presented as 1.

I hesitate to muck around in the source macro code to "fix" this, as the law of unintended consequences almost always seems to prevail.

 

Thanks to everyone - @Rick_SAS , @ballardw , @StatDave , @FreelanceReinh 

 

SteveDenham

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1567 views
  • 2 likes
  • 5 in conversation