Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate STD() vs. Excel STDEV() function
Message
From
02/09/2002 09:56:31
 
 
To
02/09/2002 09:37:14
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00695910
Message ID:
00695937
Views:
17
>>I don't know a native command. I could probably write you a func... if you ever need it. I was reading somewhere that fox is quite good for developing mathematical functions (amongst other things) etc
>
>OK, thanks.

Couldn't resist the challenge...

FUNCTION MyStDev
LPARAMETERS tcfieldName, tcAlias
LOCAL lnReccount, lnSum, lnSquare
LOCAL lcTalk

lcTalk = SET( "TALK")
SET TALK OFF

lnReccount = RECCOUNT( tcAlias)

CALCULATE SUM( EVALUATE( tcFieldName)) TO lnSum

CALCULATE SUM( EVALUATE( tcFieldName)^2) TO lnSquare

SET TALK &lcTalk

RETURN SQRT((( lnReccount*lnSquare) - ( lnSum^2))/ (lnReccount*(lnReccount-1)))
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform