메뉴 건너뛰기

SAP 한국 커뮤니티

표준편차구하는 로직

윤사모 2011.03.23 17:37 조회 수 : 9371

REPORT abc.

DATA : BEGIN OF itab OCCURS 0,
num TYPE i,
END OF itab.
data : std type p decimals 2.

*-------------------------------------------------

itab-num = 8. APPEND itab.
itab-num = 25. APPEND itab.
itab-num = 7. APPEND itab.
itab-num = 5. APPEND itab.

itab-num = 8. APPEND itab.
itab-num = 3. APPEND itab.
itab-num = 10. APPEND itab.
itab-num = 12. APPEND itab.
itab-num = 9. APPEND itab.

PERFORM stdev changing std..

write :/ std.

*-------------------------------------------------

*-------------------------------------------------
*
*-------------------------------------------------

FORM stdev CHANGING std.

DATA : mn TYPE p DECIMALS 2.
DATA : sm TYPE i.
DATA : sm2 TYPE i.
DATA : dev TYPE p DECIMALS 2.

DATA : cnt TYPE i.

LOOP AT itab.
sm = sm + itab-num.
cnt = cnt + 1.
sm2 = sm2 + ( itab-num * itab-num ).
ENDLOOP.

mn = sm / cnt.

dev = ( sm2 - ( ( ( sm * sm ) / cnt ) ) ) / ( cnt - 1 ) .
dev = SQRT( dev ).

std = dev.

ENDFORM. "stdev

번호 제목 글쓴이 날짜 조회 수
487 Effective_Code_Writing [3] file sapjoy 2007.04.18 2991
486 sap perforamnce check t-code list [2] sapjoy 2014.06.16 3043
485 Creating Custom Screen in XD01 [2] file 노름마치 2009.07.10 3055
484 Working with Substitution Exit [6] file 노름마치 2009.07.10 3064
483 Implementing Field Exit for the transaction MK01 [3] file 노름마치 2009.07.10 3150
482 Working with User-Exits for the transaction VA01 [3] file 노름마치 2009.07.10 3170
481 User Parameter 조회 펑션 [3] 양키(이경환) 2014.03.04 3180
480 Do and Dont's in ABAP Programming [5] file sapjoy 2007.04.18 3182
479 Creating Change Documents for Custom tables (Step-by-step procedure) Using SCDO [2] file 노름마치 2009.07.10 3194
478 jco_tutorial-ja_doo [2] file kk 2008.01.23 3197
477 Adding Custom Fields using EEWB Transaction [1] file 노름마치 2009.07.10 3217
476 BTE_Scenario on Business Transaction Events [7] file 노름마치 2009.07.10 3272
475 Restrict users (sales persons) to view or change Sales order data - Using Enhancement framework [3] file 노름마치 2009.07.10 3297
474 BDC 수행시 COMMAND 명령어 sapjoy 2014.09.18 3301
473 SAP tips Journal - 6,7월 호 (2008) [9] file onefineday 2009.02.11 3303
472 Setting the screen elements as mandatory in the transaction DP95 using Enhancement Framework [2] file 노름마치 2009.07.10 3314
471 ALV TOOLBAR 메뉴 버튼을 올립니다. [6] file 블루보이 2013.06.26 3322
470 드롭다운 리스트 key값 조회하기 [4] file 아밥뽀 2014.09.21 3341
469 대용량 DATA 병렬 처리 샘플 프로그램 - Parallel Process [2] file moonical 2021.09.09 3343
468 Creating Change Document Object Using SCDO [2] file 노름마치 2009.07.10 3356