Programming the statistical procedures from SAS

Obtain the means and variances across time by group (change long data to wide)

Reply
Occasional Contributor
Posts: 5

Obtain the means and variances across time by group (change long data to wide)

I am trying to obtain the means and variances of grip-strength across time by group and Plot the group means across time.

The data order is ID, Group(0=placebo and 1= treatment), Time (0-3), Grip Strength, Status (0= no pain and 1 = pain)

The data I have is long data, and I plot the means across time by group before with following SAS code


PROC SUMMARY NWAY DATA=Final.exam;

CLASS GROUP;  VAR measu1 measu2 measu3 measu4;

OUTPUT OUT=heart.B MEAN = ameasu1 ameasu2 ameasu3 ameasu4;

DATA HEART.PLOT;

SET heart.B;

ARRAY ameasu(4)  ameasu1 ameasu2 ameasu3 ameasu4;

DO TIME = 1 TO 4;

MEANMEASU = ameasu(TIME);

OUTPUT;

END;

DROP  ameasu1 ameasu2 ameasu3 ameasu4;

end;

PROC gPLOT

PLOT MEANMEASU*TIME=Group;

FORMAT Group Group.;

RUN;

So should I change long data to wide data and run the above code?

Attachment
Ask a Question
Discussion stats
  • 0 replies
  • 315 views
  • 0 likes
  • 1 in conversation