BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello, 

I created a sum variable to add up all the columns, the sum results are all missing.  All the columns are dollar10.2, why?

data want;
	format sum dollar10.2;
	set test;
	sum=.;
	sum = Room_ED + Room_ICU + Room_Regular + Physician_Fee + Lab+Radiology + Diagnostic_Other + Pharma + Thera + Unclass;
	keep id sum;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

For every observations at least one of the values in missing.

Are you sure all of the variables are numeric?

Are you sure all of them have a value on every observation?

Are you sure you typed the variable names properly in your assignment statement?

If you want to treat missing values are zero then use the SUM() function instead of the addition operator.

sum=sum(of Room_ED Room_ICU Room_Regular Physician_Fee Lab Radiology Diagnostic_Other Pharma Thera Unclass);

The format attached to the variable is only used for DISPLAYING the values.  It has no impact on the values themselves.

If you want to see which values are missing remove the KEEP statement so all of the variables will be in the output dataset so you can review the values.

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

For every observations at least one of the values in missing.

Are you sure all of the variables are numeric?

Are you sure all of them have a value on every observation?

Are you sure you typed the variable names properly in your assignment statement?

If you want to treat missing values are zero then use the SUM() function instead of the addition operator.

sum=sum(of Room_ED Room_ICU Room_Regular Physician_Fee Lab Radiology Diagnostic_Other Pharma Thera Unclass);

The format attached to the variable is only used for DISPLAYING the values.  It has no impact on the values themselves.

If you want to see which values are missing remove the KEEP statement so all of the variables will be in the output dataset so you can review the values.

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 473 views
  • 1 like
  • 2 in conversation