turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Summing many variables

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-14-2013 06:18 PM

Hi,

I think there's a simple solution to this problem, but I can't find it for the life of me.

I have a wide dataset of about 800 people that includes all the visits they made to their doctors over a period of 2 years. Some people visited once (everyone had to visit at least once to be included) and some visited many times- one person had 910 visits. For each visit, I have a continuous number that indicates the amount of time the doctor spent on that visit. For each patient, I want to add up all the times over the two year period so that each patient has one "total" time value. I want the missing values to count as zeroes. If there were not many visits, I would just use the sum statement, like:

total_time=sum(time1,time2,time3);

But do I really have to write it out 910 times?? I tried using a dash:

total_time=sum(time1-time910);

But total_time was missing as a result of doing that.

Is there any other way? Thanks so much in advance.

Laurie

Accepted Solutions

Solution

02-14-2013
06:57 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-14-2013 06:57 PM

totat=sum**(OF** time1-time910);

All Replies

Solution

02-14-2013
06:57 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-14-2013 06:57 PM

totat=sum**(OF** time1-time910);