SAS Studio

Write and run SAS programs in your web browser
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HSM9
Calcite | Level 5

I am creating a scatter plot where I want upper and and lower limits that use the code below. The issue is that when I try to define the variables something goes wrong when putting the standard deviation in the statement. An error comes up saying that I don't have enough arguments. How do I fix this?

 

DATA WORK.Case_Control;
SET Epid.case_control_analysis;
Diff = BMI_GS - BMI_SR;
UpperLimit = MEAN(Diff) + 1.96*STD(diff);
LowerLimit = MEAN (Diff) - 1.96*STD(diff);
Bias = MEAN(diff);

 

proc means data = WORK.Case_Control mean std;
Var Diff;
run;

 

Proc SGplot data = WORK.Case_Control;

scatter X = BMI_GS Y = Diff;
label BMI_GS = "Gold-Standard BMI Measure";
label Diff = "Gold-Standard - Self-Report";
refline 0 / transparency = 0.1 lineattrs=(color=black pattern =1 thickness =3);
refline UpperLimit / transparency = 0.1 Label = ('Upper Limit of Agreement') lineattrs=(color=red pattern=2 thickness =3);
refline LowerLimit / transparency = 0.1 Label = ('Lower Limit of Agreement') lineattrs=(color=red pattern=2 thickness =3);
refline Bias / transparency = 0.1 Label = ('Bias') lineattrs=(color=red thickness =3);
run;

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

You should define dataset case_control as:

 

proc sql;
create table Case_Control as
select
    BMI_GS, BMI_SR,
    BMI_GS - BMI_SR as diff,
    mean(BMI_GS - BMI_SR) as bias,
    mean(BMI_GS - BMI_SR) - 1.96*std(BMI_GS - BMI_SR) as lowerLimit,
    mean(BMI_GS - BMI_SR) + 1.96*std(BMI_GS - BMI_SR) as upperLimit    
from Epid.case_control_analysis;
quit;
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

You should define dataset case_control as:

 

proc sql;
create table Case_Control as
select
    BMI_GS, BMI_SR,
    BMI_GS - BMI_SR as diff,
    mean(BMI_GS - BMI_SR) as bias,
    mean(BMI_GS - BMI_SR) - 1.96*std(BMI_GS - BMI_SR) as lowerLimit,
    mean(BMI_GS - BMI_SR) + 1.96*std(BMI_GS - BMI_SR) as upperLimit    
from Epid.case_control_analysis;
quit;
PG
HSM9
Calcite | Level 5

Awesome, I finally got that to work.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1046 views
  • 0 likes
  • 2 in conversation