BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kyra
Quartz | Level 8

Hi,

 

I want to conduct a study where i am looking at BMI at screening, BMI at Operation day, BMI at 6 months post op and BMI at 12 months post-op. I want to see if patients who lost weight pre-op were able to sustain loss after surgery.

 

Please let me know how should i do that in SAS.

 

Thanks.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

I converted the small spreadsheet to a program using a task I have from SAS Enterprise Guide.

 


/*This program was generated from WORK.DATA */
DATA WORK.DATA;
	attrib Age 
		length=8
		format=BEST12. 
		informat=BEST12. ;
	attrib Sex 
		length=$1
		format=$CHAR1. 
		informat=$CHAR1. ;
	attrib Ethnicity 
		length=$12
		format=$CHAR12. 
		informat=$CHAR12. ;
	attrib Race 
		length=$24
		format=$CHAR24. 
		informat=$CHAR24. ;
	attrib Screening_BMI 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='Screening BMI' ;
	attrib PreOpBMI 
		length=8
		format=BEST12. 
		informat=BEST12. ;
	attrib BMI12_mo 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='BMI12 mo' ;
	attrib BMI24_mo 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='BMI24  mo' ;
	attrib Creatinine_2_wkpost_op 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='Creatinine 2 wkpost-op' ;
	attrib EGFR_post_op 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='EGFR post op' ;
INFILE DATALINES DSD;
INPUT 
	Age
	Sex
	Ethnicity
	Race
	Screening_BMI
	PreOpBMI
	BMI12_mo
	BMI24_mo
	Creatinine_2_wkpost_op
	EGFR_post_op
	;
DATALINES4;
60,"M","Non-Hispanic","Caucasian (White)",29.9,29.8,27.8,28.1,1.63,57.35
45,"F","Non-Hispanic","Caucasian (White)",28.8,28.8,,,1.18,58.2
62,"M","Non-Hispanic","Unknown",25.1,25.1,,,1.35,58.47
60,"F","Non-Hispanic","African American (Black)",28.5,28.5,31.9,30.3,1.35,60
65,"F","Non-Hispanic","Other",26.5,26.8,26.9,,0.86,60
66,"F","Non-Hispanic","Asian",31,30.8,30.9,30.7,1.15,60
40,"F","Non-Hispanic","Caucasian (White)",27.8,27.8,28.7,29.7,1.2,48.32
48,"M","Non-Hispanic","Other",28,27.8,,,1.29,51.65
50,"F","Non-Hispanic","Caucasian (White)",30,29.4,28.2,28.8,1.62,35.79
;;;;
RUN;


From your description, it looks like you're just testing for a simple condition.  

 

 IF Screening_BMI > 30 THEN 

   if BMI_12mo Screening_BMI Then

     Sustained_WeightLoss = 1 (true)

 

data result;
 set work.data;

 if missing(bmi12_mo) then sustained_wtLoss12 = .;
 else if screening_bmi >= 30
    and bmi12_mo < screening_bmi
  then sustained_wtLoss12 = 1;
  else sustained_wtLoss12 = 0;


 if missing(bmi24_mo) then sustained_wtLoss24 = .;
 else if screening_bmi >= 30
    and bmi24_mo < screening_bmi
  then sustained_wtLoss24 = 1;
  else sustained_wtLoss24 = 0;

run;
Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

View solution in original post

8 REPLIES 8
ChrisHemedinger
Community Manager

Sounds like you would like some guidance about how to design your study...not just the mechanics of running it in SAS, correct? 

 

If you already have sample data that shows what you expect to collect, I think the experts here can provide more help.

 

If all you are collecting is the measurements for people who have the surgery, then the approach is straightforward.  You're just calculating the differences across each measurement.  If there are other factors you're tracking that lead to something you're trying to predict, then the approach would be different.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Kurt_Bremser
Super User

The first thing you need to do is to post an example of your raw SAS data that you already have. After that we can show you ways to extract the information you are looking for. See my footnotes for hints how to post that example data.

Kyra
Quartz | Level 8

Hi,

 
please see attached part of my data in excel.
I need to see if patients who were obese BMI>30 at sceening and lost weight at preop visit had sustained weight loss after the procedure.
 
Thanks.
ChrisHemedinger
Community Manager

I converted the small spreadsheet to a program using a task I have from SAS Enterprise Guide.

 


/*This program was generated from WORK.DATA */
DATA WORK.DATA;
	attrib Age 
		length=8
		format=BEST12. 
		informat=BEST12. ;
	attrib Sex 
		length=$1
		format=$CHAR1. 
		informat=$CHAR1. ;
	attrib Ethnicity 
		length=$12
		format=$CHAR12. 
		informat=$CHAR12. ;
	attrib Race 
		length=$24
		format=$CHAR24. 
		informat=$CHAR24. ;
	attrib Screening_BMI 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='Screening BMI' ;
	attrib PreOpBMI 
		length=8
		format=BEST12. 
		informat=BEST12. ;
	attrib BMI12_mo 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='BMI12 mo' ;
	attrib BMI24_mo 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='BMI24  mo' ;
	attrib Creatinine_2_wkpost_op 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='Creatinine 2 wkpost-op' ;
	attrib EGFR_post_op 
		length=8
		format=BEST12. 
		informat=BEST12. 
		label='EGFR post op' ;
INFILE DATALINES DSD;
INPUT 
	Age
	Sex
	Ethnicity
	Race
	Screening_BMI
	PreOpBMI
	BMI12_mo
	BMI24_mo
	Creatinine_2_wkpost_op
	EGFR_post_op
	;
DATALINES4;
60,"M","Non-Hispanic","Caucasian (White)",29.9,29.8,27.8,28.1,1.63,57.35
45,"F","Non-Hispanic","Caucasian (White)",28.8,28.8,,,1.18,58.2
62,"M","Non-Hispanic","Unknown",25.1,25.1,,,1.35,58.47
60,"F","Non-Hispanic","African American (Black)",28.5,28.5,31.9,30.3,1.35,60
65,"F","Non-Hispanic","Other",26.5,26.8,26.9,,0.86,60
66,"F","Non-Hispanic","Asian",31,30.8,30.9,30.7,1.15,60
40,"F","Non-Hispanic","Caucasian (White)",27.8,27.8,28.7,29.7,1.2,48.32
48,"M","Non-Hispanic","Other",28,27.8,,,1.29,51.65
50,"F","Non-Hispanic","Caucasian (White)",30,29.4,28.2,28.8,1.62,35.79
;;;;
RUN;


From your description, it looks like you're just testing for a simple condition.  

 

 IF Screening_BMI > 30 THEN 

   if BMI_12mo Screening_BMI Then

     Sustained_WeightLoss = 1 (true)

 

data result;
 set work.data;

 if missing(bmi12_mo) then sustained_wtLoss12 = .;
 else if screening_bmi >= 30
    and bmi12_mo < screening_bmi
  then sustained_wtLoss12 = 1;
  else sustained_wtLoss12 = 0;


 if missing(bmi24_mo) then sustained_wtLoss24 = .;
 else if screening_bmi >= 30
    and bmi24_mo < screening_bmi
  then sustained_wtLoss24 = 1;
  else sustained_wtLoss24 = 0;

run;
Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Kyra
Quartz | Level 8

thank you very much. I understand what i need to do now.

Doc_Duke
Rhodochrosite | Level 12

Kyra,

 

It looks like you have missing data in the BMIs.  The approach Chris provided is just one way to address missingness and may or may not be appropriate.  I'd suggest also reading about the types of missing data and approaches to address it.  Perhaps start with D. A. Newman's 2014 article in Organizational Research Methods ( https://www.researchgate.net/publication/268686755_Missing_Data ).

 

Doc Muhlbaier

Duke

Kyra
Quartz | Level 8

Thanks. I will look into the articles.

 

 

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 8 replies
  • 1313 views
  • 3 likes
  • 4 in conversation