Hello, I am having a bit of trouble with the plot for this problem:
"The file QoL.xls, has the following variables: ID, quality of life variables MLHF (Minnesota Living with Heart failure) and the SF_36 and CPGS and the date the QoL survey was administered."
"Each patient had three (3) exams, but they are not in order in the data file."
Make one plot: Mean change in CPGS (Chronic Pain Grade Scale) over time
Here is my data (I reordered the dates, expanded to the other variable columns as well. The "9" is a junk column, no importance)
ID | mlhf | sf36 | CPGS | date | score | sex | 9 |
13 | 21 | 45 | 51 | 5/6/10 | 59 | M | 9 |
30 | 62 | 77 | 92 | 5/6/10 | 84 | F | 9 |
15 | 64 | 77 | 64 | 5/19/10 | 27 | M | 9 |
6 | 23 | 100 | 53 | 12/24/10 | 14 | M | 9 |
3 | 67 | 100 | 67 | 12/31/10 | 32 | M | 9 |
14 | 22 | 97 | 55 | 1/27/11 | 55 | M | 9 |
30 | 52 | 100 | 55 | 1/27/11 | 95 | F | 9 |
10 | 61 | 94 | 61 | 4/15/11 | 63 | M | 9 |
29 | 23 | 97 | 53 | 4/15/11 | 53 | F | 9 |
4 | 40 | 95 | 66 | 6/21/11 | 48 | M | 9 |
16 | 57 | 67 | 57 | 7/14/11 | 11 | M | 9 |
15 | 64 | 97 | 64 | 7/23/11 | 39 | M | 9 |
14 | 22 | 97 | 55 | 9/30/11 | 55 | M | 9 |
31 | 75 | 57 | 75 | 9/30/11 | 22 | F | 9 |
6 | 22 | 77 | 55 | 10/10/11 | 75 | M | 9 |
5 | 59 | 100 | 59 | 1/3/12 | 44 | M | 9 |
19 | 40 | 96 | 49 | 2/6/12 | 49 | F | 9 |
16 | 67 | 45 | 67 | 2/9/12 | 10 | M | 9 |
10 | 61 | 75 | 61 | 3/15/12 | 63 | M | 9 |
29 | 65 | 77 | 65 | 3/15/12 | 65 | F | 9 |
14 | 22 | 94 | 55 | 4/6/12 | 55 | M | 9 |
31 | 76 | 22 | 100 | 4/6/12 | 11 | F | 9 |
7 | 69 | 43 | 69 | 4/19/12 | 69 | M | 9 |
23 | 53 | 93 | 53 | 4/19/12 | 33 | F | 9 |
5 | 69 | 66 | 69 | 9/5/12 | 46 | M | 9 |
19 | 41 | 96 | 41 | 9/17/12 | 43 | F | 9 |
22 | 54 | 92 | 54 | 11/6/12 | 33 | F | 9 |
1 | 22 | 36 | 55 | 12/15/12 | 43 | M | 9 |
10 | 61 | 97 | 61 | 12/17/12 | 63 | M | 9 |
27 | 64 | 96 | 64 | 12/17/12 | 64 | F | 9 |
7 | 69 | 67 | 69 | 2/4/13 | 69 | M | 9 |
23 | 63 | 93 | 63 | 2/4/13 | 63 | F | 9 |
17 | 72 | 33 | 75 | 2/11/13 | 75 | M | 9 |
13 | 31 | 97 | 66 | 3/3/13 | 66 | M | 9 |
30 | 52 | 100 | 55 | 3/3/13 | 77 | F | 9 |
8 | 50 | 94 | 59 | 4/1/13 | 59 | M | 9 |
23 | 52 | 13 | 55 | 4/1/13 | 55 | F | 9 |
1 | 37 | 39 | 37 | 4/5/13 | 12 | M | 9 |
9 | 54 | 46 | 54 | 4/22/13 | 72 | M | 9 |
27 | 22 | 77 | 55 | 4/22/13 | 55 | F | 9 |
21 | 64 | 95 | 68 | 6/3/13 | 68 | F | 9 |
4 | 70 | 95 | 79 | 6/20/13 | 32 | M | 9 |
3 | 76 | 77 | 15 | 7/24/13 | 35 | M | 9 |
18 | 64 | 76 | 64 | 9/12/13 | 64 | F | 9 |
6 | 23 | 33 | 53 | 2/7/14 | 35 | M | 9 |
9 | 54 | 76 | 54 | 2/12/14 | 54 | M | 9 |
24 | 61 | 94 | 61 | 2/12/14 | 63 | F | 9 |
15 | 64 | 100 | 33 | 4/17/14 | 33 | M | 9 |
31 | 45 | 57 | 45 | 4/17/14 | 23 | F | 9 |
9 | 64 | 67 | 64 | 6/19/14 | 64 | M | 9 |
27 | 64 | 96 | 64 | 6/19/14 | 64 | F | 9 |
13 | 31 | 77 | 31 | 6/20/14 | 33 | M | 9 |
29 | 65 | 94 | 65 | 6/20/14 | 65 | F | 9 |
22 | 66 | 43 | 88 | 7/16/14 | 88 | F | 9 |
18 | 64 | 76 | 64 | 9/11/14 | 64 | F | 9 |
8 | 50 | 22 | 59 | 1/20/15 | 35 | M | 9 |
24 | 44 | 97 | 44 | 1/20/15 | 44 | F | 9 |
21 | 64 | 95 | 64 | 2/11/15 | 64 | F | 9 |
1 | 24 | 29 | 54 | 2/26/15 | 44 | M | 9 |
18 | 44 | 45 | 88 | 4/3/15 | 88 | F | 9 |
19 | 70 | 96 | 79 | 5/9/15 | 79 | F | 9 |
8 | 61 | 94 | 61 | 5/13/15 | 63 | M | 9 |
24 | 61 | 97 | 61 | 5/13/15 | 63 | F | 9 |
5 | 59 | 97 | 59 | 6/11/15 | 12 | M | 9 |
21 | 77 | 95 | 77 | 11/14/15 | 77 | F | 9 |
7 | 69 | 90 | 69 | 11/16/15 | 33 | M | 9 |
17 | 72 | 95 | 75 | 11/16/15 | 13 | M | 9 |
22 | 66 | 22 | 66 | 11/16/15 | 66 | F | 9 |
3 | 67 | 76 | 67 | 12/17/15 | 86 | M | 9 |
16 | 57 | 32 | 57 | 1/2/16 | 92 | M | 9 |
17 | 42 | 95 | 45 | 4/11/16 | 45 | F | 9 |
4 | 71 | 95 | 71 | 4/14/16 | 73 | M | 9 |
Here is my code. It gives me a plot, but I'm not sure if it's the right plot:
proc means data=fep7 NWAY;
title9 "Mean change in CPGS (Chronic Pain Grade Scale) over time";
class ID;
var CPGS;
output out=out mean =;
run;
proc gplot data=out;
plot CPGS*ID /Haxis=0 to 20
Vaxis=40.0 to 50.0;
symbol1 V=circle c=black I=join Line=1;
run;
quit;
I also attached a screenshot of the graph, if you needed a look.
I'd greatly appreciate your input. Thanks in advance!
I don't think this is correct. The question is "Mean change in CPGS (Chronic Pain Grade Scale) over time"
It looks like you're plotting the mean scores not the mean change. So you first need to figure out the change and then find the average and then plot that.
If I understand the question correctly.
I would strongly recommend using SGPLOT and nothing related to GPLOT in SAS. GPLOT is outdated and it's harder to use.
@sascrazedpupil wrote:
Hello, I am having a bit of trouble with the plot for this problem:
"The file QoL.xls, has the following variables: ID, quality of life variables MLHF (Minnesota Living with Heart failure) and the SF_36 and CPGS and the date the QoL survey was administered."
"Each patient had three (3) exams, but they are not in order in the data file."
Make one plot: Mean change in CPGS (Chronic Pain Grade Scale) over time
Here is my data (I reordered the dates, expanded to the other variable columns as well. The "9" is a junk column, no importance)
ID mlhf sf36 CPGS date score sex 9 13 21 45 51 5/6/10 59 M 9 30 62 77 92 5/6/10 84 F 9 15 64 77 64 5/19/10 27 M 9 6 23 100 53 12/24/10 14 M 9 3 67 100 67 12/31/10 32 M 9 14 22 97 55 1/27/11 55 M 9 30 52 100 55 1/27/11 95 F 9 10 61 94 61 4/15/11 63 M 9 29 23 97 53 4/15/11 53 F 9 4 40 95 66 6/21/11 48 M 9 16 57 67 57 7/14/11 11 M 9 15 64 97 64 7/23/11 39 M 9 14 22 97 55 9/30/11 55 M 9 31 75 57 75 9/30/11 22 F 9 6 22 77 55 10/10/11 75 M 9 5 59 100 59 1/3/12 44 M 9 19 40 96 49 2/6/12 49 F 9 16 67 45 67 2/9/12 10 M 9 10 61 75 61 3/15/12 63 M 9 29 65 77 65 3/15/12 65 F 9 14 22 94 55 4/6/12 55 M 9 31 76 22 100 4/6/12 11 F 9 7 69 43 69 4/19/12 69 M 9 23 53 93 53 4/19/12 33 F 9 5 69 66 69 9/5/12 46 M 9 19 41 96 41 9/17/12 43 F 9 22 54 92 54 11/6/12 33 F 9 1 22 36 55 12/15/12 43 M 9 10 61 97 61 12/17/12 63 M 9 27 64 96 64 12/17/12 64 F 9 7 69 67 69 2/4/13 69 M 9 23 63 93 63 2/4/13 63 F 9 17 72 33 75 2/11/13 75 M 9 13 31 97 66 3/3/13 66 M 9 30 52 100 55 3/3/13 77 F 9 8 50 94 59 4/1/13 59 M 9 23 52 13 55 4/1/13 55 F 9 1 37 39 37 4/5/13 12 M 9 9 54 46 54 4/22/13 72 M 9 27 22 77 55 4/22/13 55 F 9 21 64 95 68 6/3/13 68 F 9 4 70 95 79 6/20/13 32 M 9 3 76 77 15 7/24/13 35 M 9 18 64 76 64 9/12/13 64 F 9 6 23 33 53 2/7/14 35 M 9 9 54 76 54 2/12/14 54 M 9 24 61 94 61 2/12/14 63 F 9 15 64 100 33 4/17/14 33 M 9 31 45 57 45 4/17/14 23 F 9 9 64 67 64 6/19/14 64 M 9 27 64 96 64 6/19/14 64 F 9 13 31 77 31 6/20/14 33 M 9 29 65 94 65 6/20/14 65 F 9 22 66 43 88 7/16/14 88 F 9 18 64 76 64 9/11/14 64 F 9 8 50 22 59 1/20/15 35 M 9 24 44 97 44 1/20/15 44 F 9 21 64 95 64 2/11/15 64 F 9 1 24 29 54 2/26/15 44 M 9 18 44 45 88 4/3/15 88 F 9 19 70 96 79 5/9/15 79 F 9 8 61 94 61 5/13/15 63 M 9 24 61 97 61 5/13/15 63 F 9 5 59 97 59 6/11/15 12 M 9 21 77 95 77 11/14/15 77 F 9 7 69 90 69 11/16/15 33 M 9 17 72 95 75 11/16/15 13 M 9 22 66 22 66 11/16/15 66 F 9 3 67 76 67 12/17/15 86 M 9 16 57 32 57 1/2/16 92 M 9 17 42 95 45 4/11/16 45 F 9 4 71 95 71 4/14/16 73 M 9
Here is my code. It gives me a plot, but I'm not sure if it's the right plot:
proc means data=fep7 NWAY;
title9 "Mean change in CPGS (Chronic Pain Grade Scale) over time";
class ID;
var CPGS;
output out=out mean =;
run;
proc gplot data=out;
plot CPGS*ID /Haxis=0 to 20
Vaxis=40.0 to 50.0;
symbol1 V=circle c=black I=join Line=1;
run;
quit;I also attached a screenshot of the graph, if you needed a look.
I'd greatly appreciate your input. Thanks in advance!
I don't think this is correct. The question is "Mean change in CPGS (Chronic Pain Grade Scale) over time"
It looks like you're plotting the mean scores not the mean change. So you first need to figure out the change and then find the average and then plot that.
If I understand the question correctly.
I would strongly recommend using SGPLOT and nothing related to GPLOT in SAS. GPLOT is outdated and it's harder to use.
@sascrazedpupil wrote:
Hello, I am having a bit of trouble with the plot for this problem:
"The file QoL.xls, has the following variables: ID, quality of life variables MLHF (Minnesota Living with Heart failure) and the SF_36 and CPGS and the date the QoL survey was administered."
"Each patient had three (3) exams, but they are not in order in the data file."
Make one plot: Mean change in CPGS (Chronic Pain Grade Scale) over time
Here is my data (I reordered the dates, expanded to the other variable columns as well. The "9" is a junk column, no importance)
ID mlhf sf36 CPGS date score sex 9 13 21 45 51 5/6/10 59 M 9 30 62 77 92 5/6/10 84 F 9 15 64 77 64 5/19/10 27 M 9 6 23 100 53 12/24/10 14 M 9 3 67 100 67 12/31/10 32 M 9 14 22 97 55 1/27/11 55 M 9 30 52 100 55 1/27/11 95 F 9 10 61 94 61 4/15/11 63 M 9 29 23 97 53 4/15/11 53 F 9 4 40 95 66 6/21/11 48 M 9 16 57 67 57 7/14/11 11 M 9 15 64 97 64 7/23/11 39 M 9 14 22 97 55 9/30/11 55 M 9 31 75 57 75 9/30/11 22 F 9 6 22 77 55 10/10/11 75 M 9 5 59 100 59 1/3/12 44 M 9 19 40 96 49 2/6/12 49 F 9 16 67 45 67 2/9/12 10 M 9 10 61 75 61 3/15/12 63 M 9 29 65 77 65 3/15/12 65 F 9 14 22 94 55 4/6/12 55 M 9 31 76 22 100 4/6/12 11 F 9 7 69 43 69 4/19/12 69 M 9 23 53 93 53 4/19/12 33 F 9 5 69 66 69 9/5/12 46 M 9 19 41 96 41 9/17/12 43 F 9 22 54 92 54 11/6/12 33 F 9 1 22 36 55 12/15/12 43 M 9 10 61 97 61 12/17/12 63 M 9 27 64 96 64 12/17/12 64 F 9 7 69 67 69 2/4/13 69 M 9 23 63 93 63 2/4/13 63 F 9 17 72 33 75 2/11/13 75 M 9 13 31 97 66 3/3/13 66 M 9 30 52 100 55 3/3/13 77 F 9 8 50 94 59 4/1/13 59 M 9 23 52 13 55 4/1/13 55 F 9 1 37 39 37 4/5/13 12 M 9 9 54 46 54 4/22/13 72 M 9 27 22 77 55 4/22/13 55 F 9 21 64 95 68 6/3/13 68 F 9 4 70 95 79 6/20/13 32 M 9 3 76 77 15 7/24/13 35 M 9 18 64 76 64 9/12/13 64 F 9 6 23 33 53 2/7/14 35 M 9 9 54 76 54 2/12/14 54 M 9 24 61 94 61 2/12/14 63 F 9 15 64 100 33 4/17/14 33 M 9 31 45 57 45 4/17/14 23 F 9 9 64 67 64 6/19/14 64 M 9 27 64 96 64 6/19/14 64 F 9 13 31 77 31 6/20/14 33 M 9 29 65 94 65 6/20/14 65 F 9 22 66 43 88 7/16/14 88 F 9 18 64 76 64 9/11/14 64 F 9 8 50 22 59 1/20/15 35 M 9 24 44 97 44 1/20/15 44 F 9 21 64 95 64 2/11/15 64 F 9 1 24 29 54 2/26/15 44 M 9 18 44 45 88 4/3/15 88 F 9 19 70 96 79 5/9/15 79 F 9 8 61 94 61 5/13/15 63 M 9 24 61 97 61 5/13/15 63 F 9 5 59 97 59 6/11/15 12 M 9 21 77 95 77 11/14/15 77 F 9 7 69 90 69 11/16/15 33 M 9 17 72 95 75 11/16/15 13 M 9 22 66 22 66 11/16/15 66 F 9 3 67 76 67 12/17/15 86 M 9 16 57 32 57 1/2/16 92 M 9 17 42 95 45 4/11/16 45 F 9 4 71 95 71 4/14/16 73 M 9
Here is my code. It gives me a plot, but I'm not sure if it's the right plot:
proc means data=fep7 NWAY;
title9 "Mean change in CPGS (Chronic Pain Grade Scale) over time";
class ID;
var CPGS;
output out=out mean =;
run;
proc gplot data=out;
plot CPGS*ID /Haxis=0 to 20
Vaxis=40.0 to 50.0;
symbol1 V=circle c=black I=join Line=1;
run;
quit;I also attached a screenshot of the graph, if you needed a look.
I'd greatly appreciate your input. Thanks in advance!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: