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

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
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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;
Etoo12121
Obsidian | Level 7
just what I needed to set up. Thanks

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 811 views
  • 2 likes
  • 2 in conversation