How to create scalar function of SQL Server in order to define nPNA?

The Japanese Society for Dialysis Therapy (JSDT) recommends PCR as an indicator of protein intake. Otherwise K/DOQQI recommends nPNA. If you calculate Kt/V with Daugirdas’ method, you can also define nPNA.

\displaystyle \mathrm{nPNA} = \frac{C_0}{36.3 + 5.48\times\mathrm{Kt/V} + 53.5/\mathrm{Kt/V}} + 0.168 \\  = \frac{\mathrm{preBUN}}{36.3 + 5.48\times\mathrm{Kt/V} + 53.5 / \mathrm{Kt/V}} + 0.168 \cdots(4)

Execute the following procedure.

CREATE FUNCTION Function_nPNA 
(		@preBUN		DEC(4, 1)
	,	@postBUN	DEC(4, 1)
	,	@preWeight	DEC(4, 1)
	,	@postWeight	DEC(4, 1)
	,	@DialysisDuration	int
)
RETURNS DEC(3, 2)
AS
BEGIN
	DECLARE @nPNA	DEC(3, 2)
	SELECT	@nPNA = @preBUN
	/	(36.3 + 5.48 * (dbo.Function_KtV(@preBUN, @postBUN, @preWeight, @postWeight, @DialysisDuration))
	+			53.5 / (dbo.Function_KtV(@preBUN, @postBUN, @preWeight, @postWeight, @DialysisDuration)))
	+	0.168
	RETURN	@nPNA
END

Reference: Simplified nutritional screening tools for patients on maintenance hemodialysis