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-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
  • 1 reply
  • 161 views
  • 1 like
  • 2 in conversation