This is my first time creating graphs in SAS and need some direction. How can I create a line graph for each patient below for score1? I want visits on the x-axis and score on the y-axis. There should be 3 lines representing each of the 3 patients on one graph.
Visit | Patient | score1 |
Week1 | 1 | 0 |
Week2 | 1 | 0.8 |
Week3 | 1 | 1.1 |
Week4 | 1 | 2 |
Week1 | 2 | 1 |
Week2 | 2 | 1 |
Week3 | 2 | 1.5 |
Week4 | 2 | 1.6 |
Week1 | 3 | 0.8 |
Week2 | 3 | 0.9 |
Week3 | 3 | 1.2 |
Week4 | 3 | 1.4 |
This will get you started 🙂
data have;
input Visit $ Patient score1;
datalines;
Week1 1 0
Week2 1 0.8
Week3 1 1.1
Week4 1 2
Week1 2 1
Week2 2 1
Week3 2 1.5
Week4 2 1.6
Week1 3 0.8
Week2 3 0.9
Week3 3 1.2
Week4 3 1.4
;
proc sgplot data = have;
series x = Visit y = score1 / group = Patient;
run;
This will get you started 🙂
data have;
input Visit $ Patient score1;
datalines;
Week1 1 0
Week2 1 0.8
Week3 1 1.1
Week4 1 2
Week1 2 1
Week2 2 1
Week3 2 1.5
Week4 2 1.6
Week1 3 0.8
Week2 3 0.9
Week3 3 1.2
Week4 3 1.4
;
proc sgplot data = have;
series x = Visit y = score1 / group = Patient;
run;
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!
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.