BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Hi,

I have a dataset that looks something like this

data have;
infile datalines;
input patid $4. therapycode1 $10. visit1 duration_to_next_treatment1
therapycode2 $9. visit2 duration_to_next_treatment2 
therapycode3 $9. visit3 duration_to_next_treatment3;
datalines;
A1 FL+MM    1 100 LL+NM    2 70 FL+MM    3 40
A2 LL+MN    1 80  CC+WW    2 20 CC       3 60
A3 ZZ+BB+NN 1 50  ZZ+QQ+NN 2 66
A4 ZW+BR+MM 1 11  BR+HH    2 40 YY       3 44
A5 ZZ+BB+NN 1 0   CC       2 55
A6 ZZ+BK+NN 1 200 ZZ+BK*NN 2 6  ZZ+AA*SS 3 20
A7 QQ+HH    1 30  GG       2 89          3 15 
A8 XX+CC    1 15 PP+DD+HH  2 11 
A9 HH       1 70 ZZ+UU     2 33 DD+UU    3
A10 LL      1 300 TT+GG+RR 2 20 XX+BB    3 88
.               .
.               .
.               .
.               .
.               .

A90          1 88     
;
run;

The dataset has about 90 patients, the variables goes from about therapycode1, visit1, duration_to_next_treatment1 --therapycode9, visit9, duration_to_next_treatment9

I would like to represent this with a swimmer plot, I really don't know how to go about this, I have been racking my brain all day. Maybe someone can help.

I will really appreciate that

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

I don't understand this. What do you want to represent exactly?

Anita_n
Pyrite | Level 9
I wish to represent for each patient the time it took from the first treatment (which is the variable duration_to_next_treatment1 calculated in days) during the first visit(visit1)to start the next treatment in visit2 and from the second visit to the third visit (duration_to_next_treatment2) etc. Sorry I hope you can understand me better now.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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