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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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