BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] SAS 에서 계산된 컬럼이 같은 값이 나와야 하는데 다르게 나오거나 혹은 보여지는 값은 같으나 SAS 는 실질적으로 다르게 인식합니다.

Started ‎05-24-2021 by
Modified ‎05-24-2021 by
Views 774

SAS 는 부동소수점(Floating-point representation) 표현을 사용하며Floating-point representation 이란 컴퓨터시스템에서 실수값을 표현하는 방법입니다. 육안으로 계산 된 값이 동일하게 보이지만, 실질적으로 컴퓨터에 계산된 값은 소수점 이하 값이 다를 수 있으며 이 는 헥사(hex)값으로 변환시켜보면 다른 것을 확인하실 수 있습니다.

 

이런 경우에는 round 함수를 이용하시어 작업을 진행해주시기 바랍니다.

 

예)

data _null_;

a=1.2*1.5;

b=a-1.8;

c=round(a, 0.0001)-1.8;

put '1.2*1.5=' a 'hex=' a hex16.;

put 'a-b=' b 'hex=' b hex16.;

put 'c-b=' c hex16.;

run;

 

 

자세한 자료는 아래 링크에서 확인하실 수 있습니다.

 

http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p0ji1unv6thm0d n1gp4t01a1u0g6.htm

 

 

Version history
Last update:
‎05-24-2021 10:02 PM
Updated by:
Contributors

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Article Labels
Article Tags