BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sathish_jammy
Lapis Lazuli | Level 10

Hi all,

 

Here I have tried with the formula but I get a partial output.

By using the sample data set please proceed with the formula code.

 

data have;
input age bmi diab diab_bln$ alt ast plat albu;
cards;
61.3	25.43252595	1	no	22	18	3.29	3.2
74.4	30.04768905	2	yes	23	17	2.29	4.2
70.4	24.26987561	22	yes	19	21	2.98	4.4
56.4	38.17497196	5	no	33	25	1.97	4.4
75.4	40.96495221	2	yes	49	103	1.84	3.2
69.4	21.60288505	8	no	16	15	2.64	4.1
run;
proc print;
run;

/*Apart from 2 and 22, whatever the value on diab column it should be NO in diab_bln column*/

data want;
set have;
Score = 	
	-1.675+(0.037*age)+(0.094*bmi)+(1.13*(diab_bln = ifn(diab_bln='yes')* 1)) +
(0.99*AST/ALT) - (0.013*plat) - (0.66*albu);
run;
proc print;
run;

 

This is the exact formula:

NAFLD Score = -1.675 + (0.037*age[years]) + (0.094*BMI) + (1.13*diab [yes = 1, no = 0]) + (0.99*AST/ALT ratio) – (0.013*platelet count [×109/L]) – (0.66*albumin)

 

You may get any answer by using the formula but 

To cross check the result, The given link will use to verify the score value.

 

https://qxmd.com/calculate/calculator_341/nafld-fibrosis-score

 

Thanks in advance!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

And you may consider breaking up the formula into separate lines so that the single blocks are easier to read:

data want;
set have;
Score =	
  -1.675 +
  (0.037*age) +
  (0.094*bmi) +
  (1.13*(diab_bln = 'yes')) +
  (0.99*AST/ALT) -
  (0.013*plat) -
  (0.66*albu)
;
run;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Hint: always do a test run of your example data code, to make sure that it works (see the infile statement I had to add)

 

You are overcomplicating the check for yes/no, try this instead:

data have;
infile cards dlm='09'x;
input age bmi diab diab_bln$ alt ast plat albu;
cards;
61.3	25.43252595	1	no	22	18	3.29	3.2
74.4	30.04768905	2	yes	23	17	2.29	4.2
70.4	24.26987561	22	yes	19	21	2.98	4.4
56.4	38.17497196	5	no	33	25	1.97	4.4
75.4	40.96495221	2	yes	49	103	1.84	3.2
69.4	21.60288505	8	no	16	15	2.64	4.1
run;

data want;
set have;
Score = 	
	-1.675+(0.037*age)+(0.094*bmi)+(1.13*(diab_bln = 'yes')) +
(0.99*AST/ALT) - (0.013*plat) - (0.66*albu);
run;
Kurt_Bremser
Super User

And you may consider breaking up the formula into separate lines so that the single blocks are easier to read:

data want;
set have;
Score =	
  -1.675 +
  (0.037*age) +
  (0.094*bmi) +
  (1.13*(diab_bln = 'yes')) +
  (0.99*AST/ALT) -
  (0.013*plat) -
  (0.66*albu)
;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 645 views
  • 6 likes
  • 2 in conversation