Separating scores and time points

Separating scores and time points

by Elizabeth Adler -
Number of replies: 1

Hello,

I'm stumped for my final project figure. I want to plot Sleep Quality Index score on the Y axis and time points on the X-axis (Month 0/3/6/12/18) for an intervention and control. However, my data set is formatted in Score_M0, Score_M3, etc. such that I cannot separate the score from the time point and thus can't specify the y and x variables that I want....

 

I think I may have found a reshape command that works BUT then I still have the issue that I want the MEAN score for each group (intervention and control) for each month.

 

Any help appreciated!

In reply to Elizabeth Adler

Re: Separating scores and time points

by Bliss Temple -

You ought to be able to use the reshape command, with basic syntax

reshape long stubnames, i(varlist) [options]

to convert your data which is now in the wide format into the long format.  Then you should be able to generate the plots that you want and get the means by using the bysort prefix.

N.B. you also can always type "help reshape" or the equivalent into stata and it will give you the syntax and often example(s).  Also, of course you can always write back to the forum.