BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Lefty
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

totat=sum(OF time1-time910);

View solution in original post

1 REPLY 1
data_null__
Jade | Level 19

totat=sum(OF time1-time910);

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 687 views
  • 0 likes
  • 2 in conversation