I have been asked to create a graph to show Glasgow Coma Scale over a period of time. I have a variable for each GCS at Baseline, GCS at hospital arrival, and GCS at 2 hrs. I need to create a graph that shows these over time per subject. I have 1000 subjects, so is this even a realistic graph?
Any advice is appreciated.
Thank you.
If the goal is to be able to see individual trends over time with 1000 subject, I don't think that's a reasonable goal.
If the goal is to produce some sort of summary statistics/graphics that show an average/median/lower quartile/upper quartile etc. trending over time, that sounds like a good idea to me.
Yes, we were asked to create a graph to illustrate the relationship of these scores per subject. I am unsure of how to do that without it looking like a total mess!
Go back to the requester and ask them to draw on paper the graph(s) they want to see.
@richaemi wrote:
I have been asked to create a graph to show Glasgow Coma Scale over a period of time. I have a variable for each GCS at Baseline, GCS at hospital arrival, and GCS at 2 hrs. I need to create a graph that shows these over time per subject. I have 1000 subjects, so is this even a realistic graph?
Any advice is appreciated.
Thank you.
Could you give us an example of what some of your typical data might actually look like. Replace any identifiable information with something like XXXX or YYYY to tell subjects apart. Only need variables that you need to show.
What specific question(s) should this graph answer or provide clues about the subjects?
About the only think I could think of that I might put up with would be something with pretty transparent items so that when multiples cross or overlay they get denser and you might be able to see "clusters" of like values especially if grouped by something. But 1000 actual subject plots sounds ugly.
Yes, my attempts so far have looked like a mess.
My data right now looks like this:
GCS_24hrs (values range from 4 to 15)
GCS_Randomization (values range from 8 to 15)
GCS_ED (values range from 8 to 15)
then I have 1000 subjects.
The purpose of the graph is to show how these scores changed over time between each variable, for each subject.
I attempted to do a sort of overlay density plot and it was one of my better attempts, but it still did not look great.
You could condense the data down via Principal Components (the T-squared statistic) to a single number per subject, with very high T-squared values being the unusual ones. Once a subject with an "unusual" T-squared is identified, you could then call up the time plot for that subject.
@richaemi wrote:
Yes, my attempts so far have looked like a mess.
My data right now looks like this:
GCS_24hrs (values range from 4 to 15)
GCS_Randomization (values range from 8 to 15)
GCS_ED (values range from 8 to 15)
then I have 1000 subjects.
The purpose of the graph is to show how these scores changed over time between each variable, for each subject.
I attempted to do a sort of overlay density plot and it was one of my better attempts, but it still did not look great.
If someone wants to look at that kind of detail per subject:
1) sort the data by subject
2) use BY Subject
And then have a 1000 graphs to look at, one per subject.
Or possibly SGPANEL and Panelby Subject.
That isn't a lot of points so you could likely get a number of useable graphs per "page" of output with maybe columns=3.
So I am wondering if what they are looking for is some sort of graph that is a line per-subject situation. Would proc sgpanel be able to do this by that many variables? Should I condense my GCS variables into some sort of cohesive variable?
@richaemi wrote:
So I am wondering if what they are looking for is some sort of graph that is a line per-subject situation. Would proc sgpanel be able to do this by that many variables? Should I condense my GCS variables into some sort of cohesive variable?
So far you have mentioned 3 variables: subject timepoint measurement. Your data may not be structured that way but that is all you have referenced. So you may need to restructure you data prior to graphing. And yes SGPANEL can handle 3 variables
1) subject id would the panelby variable to create one graph per subject
2) timepoint as the X axis variable
3) measurement as the Y axis variable
with sgpanel you would definitely NOT want the ONEPANEL option to try to force all the graphs into a single image.
Who's going to look at 1000 separate graphs?
The requirements are ill-conceived and must be redefined.
It's also the role of SAS analyst to help the customer understand their own needs. Maybe a graph showing the "average" behaviour and other graphs showing outliers would be useful. Or maybe grouping similar behaviours in pools. Or maybe a dynamic 3D scatter point cloud. A discussion with the customer is the most logical next step imho.
This is an assignment for a professor, not for a customer. I am still learning SAS.
Well, before being a SAS question, it still really is thought experiment: What's the best way (regardless of the tool or coding) to show whatever is requested? Pay close attention to wording.
Once you have the answer, you can worry about how to obtain the desired result.
@richaemi wrote:
This is an assignment for a professor, not for a customer. I am still learning SAS.
Well, that's a real conundrum, isn't it? Everyone here says don't do it, everyone here says re-define the problem; your professor says to do it. Maybe your professor is testing you to see if you can recognize a poorly designed plot and come up with something better.
I'm late to this discussion, but for some examples of visualizing longitudinal data with 200 subjects, see "Create spaghetti plots in SAS."
For some data, a "lasagna plot" might be more effective because you can sort it in various ways. For 1000 subjects and one continuous response, you would need between 6000-9000 vertical screen pixels, or use 100-200 subjects per graph and produce multiple graphs.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.