공부하세요

[스크랩] [수자처리] Numeric type 16자리(8바이트) 이상 숫자 처리

김영국 2008. 4. 4. 17:44

첨부파일 BigDecimalToSas.zip

 

출처 : http://club.cyworld.com/50128728111/111339282

 

     8-byte보다 큰 두 개의 수를 

     + - × ÷ 

     사칙연산을 해보자.

     (단. type은 문자)

   

 

1. BigDecimalToSas.java 컴파일

 

   C:\ludicrous\BigDecimalToSas.java     ← JAVA파일 위치

 

   CMD창을 띄워 BigDecimalToSas.java 을 컴파일 한다.

    

 

 

   C:\ludicrous\BigDecimalToSas.class     ← 클래스파일 생성.

 

2. CLASSPATH 설정.

    

    위치 : C:\Program Files\SAS\SAS 9.1\nls\1d\SASV9.CFG     78번 LINE  

 

   /*  Options used when SAS is accessing a JVM for JNI processing  */
   -JREOPTIONS=( 
     -Dsas.jre.home=C:\PROGRA~1\SAS\SHARED~1\JRE\1499C1~1.2_0
     -Djava.security.policy=!SASROOT\core\sasmisc\sas.policy
     -Dsas.app.class.dirs=!SASROOT\core\sasmisc;C:\PROGRA~1\SAS\SHARED~1\applets\9.1
     -Dsas.jre=private
     -Dsas.ext.config=!SASROOT\core\sasmisc\sas.java.ext.config
     -DPFS_TEMPLATE=!SASROOT\core\sasmisc\qrpfstpt.xml
     -Djava.class.path=!SASROOT\core\sasmisc\sas.launcher.jar
     -Djava.system.class.loader=com.sas.app.AppClassLoader
     -Dsas.app.class.path=C:\ludicrous;    ← 문장추가   
   )

 

3. SAS 실행.

    
    data result;
      set sample;
      declare JavaObj bd1 ('BigDecimalToSas', 55);
      length result $200 method $8;
      array methods(4) $ _temporary_ ("add" "subtract" "multiply" "divide");

      bd1.callStringMethod(strip(methods(1)), strip(bignumber1), strip(bignumber2), result); output;
      bd1.callStringMethod(strip(methods(2)), strip(bignumber1), strip(bignumber2), result); output;
      bd1.callStringMethod(strip(methods(3)), strip(bignumber1), strip(bignumber2), result); output;

      bd1.callStringMethod(strip(methods(4)), strip(bignumber1), strip(bignumber2), result); output;

      drop method;
    run;
  

 

4. 연산결과

  


 

 

 

 

 

 

 

 

 ※출처

        http://www2.sas.com/proceedings/forum2008/

Paper 021-2008:

 Tan, Patrick; Vyverman, Koen

 

Ludicrously Large Numbers: Using Arbitrary Precision Arithmetic in SAS? Applications

 

 

출처 : 통계 분석 연구회 (SAS)
글쓴이 : 백승민 원글보기
메모 :