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

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)

IDmlhfsf36CPGS  datescoresex9
132145515/6/1059M9
306277925/6/1084F9
156477645/19/1027M9
6231005312/24/1014M9
3671006712/31/1032M9
142297551/27/1155M9
3052100551/27/1195F9
106194614/15/1163M9
292397534/15/1153F9
44095666/21/1148M9
165767577/14/1111M9
156497647/23/1139M9
142297559/30/1155M9
317557759/30/1122F9
622775510/10/1175M9
559100591/3/1244M9
194096492/6/1249F9
166745672/9/1210M9
106175613/15/1263M9
296577653/15/1265F9
142294554/6/1255M9
3176221004/6/1211F9
76943694/19/1269M9
235393534/19/1233F9
56966699/5/1246M9
194196419/17/1243F9
2254925411/6/1233F9
122365512/15/1243M9
1061976112/17/1263M9
2764966412/17/1264F9
76967692/4/1369M9
236393632/4/1363F9
177233752/11/1375M9
133197663/3/1366M9
3052100553/3/1377F9
85094594/1/1359M9
235213554/1/1355F9
13739374/5/1312M9
95446544/22/1372M9
272277554/22/1355F9
216495686/3/1368F9
47095796/20/1332M9
37677157/24/1335M9
186476649/12/1364F9
62333532/7/1435M9
95476542/12/1454M9
246194612/12/1463F9
1564100334/17/1433M9
314557454/17/1423F9
96467646/19/1464M9
276496646/19/1464F9
133177316/20/1433M9
296594656/20/1465F9
226643887/16/1488F9
186476649/11/1464F9
85022591/20/1535M9
244497441/20/1544F9
216495642/11/1564F9
12429542/26/1544M9
184445884/3/1588F9
197096795/9/1579F9
86194615/13/1563M9
246197615/13/1563F9
55997596/11/1512M9
2177957711/14/1577F9
769906911/16/1533M9
1772957511/16/1513M9
2266226611/16/1566F9
367766712/17/1586M9
165732571/2/1692M9
174295454/11/1645F9
47195714/14/1673M9

 

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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.

 

Spoiler

@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!


View solution in original post

1 REPLY 1
Reeza
Super User

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.

 

Spoiler

@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!


Ready to join fellow brilliant minds for the SAS Hackathon?

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!
SAS Enterprise Guide vs. SAS Studio

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.

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
  • 1 reply
  • 627 views
  • 1 like
  • 2 in conversation