BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

We have set of numeric variables in a dataset. It's having double precision value in it. We could not identify format or informat while describing the table.

How we would be able to identify the minimum and maximum precision values?

Thanks in advance.

Regards,
Satya
8 REPLIES 8
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Read this documentation reference about SAS numeric variables and precision (internal), and you would need to use the appropriate output FORMAT for displaying your data.

Scott Barry
SBBWorks, Inc.

SAS Variables

Numeric Precision in SAS Software
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000695157.htm
deleted_user
Not applicable
Thanks for the quick reply.

Sorry, my earlier post was not clear.

The columns are calculated columns and has internal precision value as '.', though it contains precision values.

So I am not able to Identify the maximum precison value this numeric field holds.

Please suggest.

Regards,
Satya
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You are indicating that the variable value is a SAS MISSING (or sometimes considered a NULL) value. There is the same precision for such a variable, determined by the SAS LENGTH associated with the variable. If unspecified, the default is SAS numeric length 8 (unless overridden).

Your condition appears to be that your SAS variable is not being computed, so you will want to review your SAS code.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
To give an example if my data is,

Col1
-----
50
10
10

Col2
-----
3
2
4


And my derived column is :

Col3 = Col1 / Col2;

In this case the output is,

Col3
-----
16.66666
5
2.5

If I have to identify the maximum precision value, then in this case it is '5'. Now is there any function or utility which will help me identifying this maximum precision.

Regards,
Satya
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You do not need to identify any maximum precision. The only reason to shorten the SAS LENGTH of a numeric variable would be to conserve disk space -- normally something you need not be concerned about. What you need to be concerned about is what "output format" to use, given your data -- again a default assignment normally satisfies the condition.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Basically I want to migrate this dataset into another database eg.Oracle. So to create a table in Oracle, I should know maximum decimal precision value / attribute definition for that column to migrate this column to Oracle.
deleted_user
Not applicable
I have tried the following code using data step and proc sql techniques. Let me know if it doesn't fit your requirement.

data sample;
input col1 col2;
cards;
50 3
10 2
10 4
;
run;

data sample1(drop=col3_c);
set sample;
col3=col1/col2;
col3_c=left(put(col3,best.));
precision=length(scan(col3_c,2, '.'));
run;

proc sql;
create table sample2 as
select col1, col2, col3, max(precision) as max_precision
from sample1;
quit;

~Sukanya E
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Consider using SAS PROC MEANS to analyze your SAS numeric data, if you need to know about data-value range.

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1075 views
  • 0 likes
  • 2 in conversation