BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kumarnaidu
Calcite | Level 5
my variableMeanStd

.±.

69.74545457.56262296
69.75±7.5668.06122458.51079746

Hi I want to combine Mean and std deviation as Mean ± Std .And I am doing this by using below code.But you can see My variable column it is not correct result.Can any one tell me why it is happening.

data average2;

my variable=compress(round(mean,0.01)||'±'||round(std,0.01));

set average1;run;

1 ACCEPTED SOLUTION

Accepted Solutions
shivas
Pyrite | Level 9

Hi Kumar,

Try this code..you results will come correct...You are combining mean and std before set statement.

data average2;

set average1;

myvariable=compress(round(mean,0.01)||'±'||round(std,0.01));

run;

Thanks,

Shiva

View solution in original post

4 REPLIES 4
Patrick
Opal | Level 21

  length my_variable $20;

  my_variable=cats(round(mean,0.01),'±',round(std,0.01));

shivas
Pyrite | Level 9

Hi Kumar,

Try this code..you results will come correct...You are combining mean and std before set statement.

data average2;

set average1;

myvariable=compress(round(mean,0.01)||'±'||round(std,0.01));

run;

Thanks,

Shiva

Jagadishkatam
Amethyst | Level 16

Hi Kumar,

you can use catx() to solve your problem. Please check the below code. hope it helps.

data concat;

input mean std;

myvariable=catx('±',mean,std);

cards;

69.7454545    7.56262296

68.0612245    8.51079746

;

run;

Output of myvariable:

69.7454545 ± 7.56262296

68.0612245 ± 8.51079746

Thanks,
Jag
kumarnaidu
Calcite | Level 5

Thanks shivas it is working.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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