BookmarkSubscribeRSS Feed
micksom
Calcite | Level 5

All,

I have a large dataset in which the majority of the cells are not populated, indicated by a '.'. This was a result of creating columns when I executed a proc transpose.

ABC

A + B + C

(CALCULATION)

1.1015.
220102050
3....

1. In datastep when I try to calculate A + B + C for row 1 in the above example, the returned value is . ,rather than 25. How do I perform a sum across columns when one or more of the fields is empty.

2. Alternatively, is there a quick way of doing an if A = . then A = 0 across two hundred columns, without having to do an if statement for all columns. Can this be done across the whole database.

3. Alternatively, is there something I can do in the proc transpose which populates the fields as 0s rather than . s

Any help would be greatly appreciated !

Regards,

Michael

2 REPLIES 2
Haikuo
Onyx | Level 15

Sum() function: Sum(a,b,c)

data_null__
Jade | Level 19

Better still leave out the transpose and just SUM the values using PROC SUMMARY using the same BY statement you used in PROC TRANSPOSE.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 823 views
  • 0 likes
  • 3 in conversation