BookmarkSubscribeRSS Feed

[엑셀 대용 함수] 변수간의 곱하기 값을 계산

Started ‎06-14-2020 by
Modified ‎06-14-2020 by
Views 188

* SAS 에서 사용자 정의 함수로 제공하는 엑셀 대용 함수를 사용 가능(Fcmp 함수 편집기)

 

OPTIONS CMPLIB=(SASHELP.SLKWXL);

* 배열과 사용자 정의 함수를 사용하여서 변수간의 곱하기 값을 계산;

DATA PRODUCT;

     A2 = 5;

     A3 = 15;

     A4 = 30;

 

     ARRAY DATA[*] A2-A4;

     VAR1 = product_slk(DATA);

     VAR2 = A2*A3*A4;

     PUT VAR1= VAR2=;

RUN;

 

 

/*---------------------------------------------------------------------

  * ENTRY:     product_slk

  *

  * PURPOSE:   Microsoft Excel's PRODUCT function.  Returns the

  *            product of a list of values.

  *

  * USAGE:     p = product_slk( n1, n2, n3, ... );

  *

  * EXAMPLES:  product_slk(2,3,4); returns 24

  *

  *--------------------------------------------------------------------*/

    len = dim(nums);

    if len eq 0 then return( . );

    prod = 1;

    do i = 1 to len;

        prod = prod * nums[i];

    end;

    return(prod);

 

 [PRODUCT] LOG 함수를 활용한 인수의 곱을 인수의 합으로 처리

 

 

[가로 변수 곱하기]

* Sample 24628: Dynamically compute product of all values in an array

  : http://support.sas.com/kb/24/628.html

 

* Sample 41728: Computing a cumulative product across observations using PROC FCMP (사용자 정의 함수)

  : http://support.sas.com/kb/41/728.html

 

* Sample 35452: Calculating the product for a single variable or across variables

  : http://support.sas.com/kb/35/452.html

 

[세로 관측치 곱하기]

* Sample 41557: Compute the product of a list of variables(매크로 구현 방식)

 : http://support.sas.com/kb/41/557.html

 

 

*********************************************************
- 통계분석연구회 
- 카페 : http://cafe.daum.net/statsas
- 통계분석연구회(Statistics Analysis Study) 그룹 :https://www.facebook.com/groups/statsas
* 친구 호출 : 답글에서 @다음에 친구 이름이나 페이지명 작성 후 친구 선택
(예 : @통계분석연구회)
#통계 #빅데이터 #통계분석연구회 #데이터과학자 

Version history
Last update:
‎06-14-2020 10:19 PM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags