## Calculate change - novice need help

Occasional Contributor
Posts: 5

# Calculate change - novice need help

Hello fellow SAS-users

I'm working on a research project, where I have to compare if there is any significant change in variables on 5 different times (TIME 1-5) in 2 randomisation groups (Randomisation_code 0 and 1) (see dataset). I need to compare them as change from time 1 to 2, 2 to 3 etc. but also over the time at last.
Variables are defined as continuous and categorical (i.e. A1=continuous, A1_pathological = categorical).
I have, so far, just made counting of variables with 'proc freq' and stratified by randomisation_code, and in addition made testing by chisq.

I am very (as very much!) new to SAS and I do not know how to move forward and manage this problem.
I will appreciate any help and step-by-step explanation.

Sincerely
Mignon

Super User
Posts: 23,776

## Re: Calculate change - novice need help

Its not clear what you need help with here. It would help to not provide excel file, but provide sample data directly in the post and show an example of what you want in the output. Many places do not allow users to download XLSX files to the system.
Occasional Contributor
Posts: 5

## Re: Calculate change - novice need help

Hi Reeza

I do not know how to explain my problem, but I'll try with an example:

1) I need to see if there is change in variable 'A1_patological' from 'time 1' to 'time 2' to 'time 3' to 'time 4' to 'time 5' in total and afterwards stratified by randomisation code (0 or 1).

My participants does not necessary have measured A1 at all 5 time points.

2) as above, just to see if variable 'A1' (continuous value) is changing (raising or falling) at this 5 time points in total and afterwards stratified by randomisation code (0 or 1).

I suppose that I can present data as a diagram.

I hope the data set is visible now with a copy and paste from Excel-file. Wasn't it that I should do?

Sincerely

Mignon

 ParticipantID_and_time Randomisation_code P_pr_min A1 A1_patological A2 A2_patological A3 A3_patological A4 A4_patological A5 A5_patological A_max_dur A_max_dur_patological TIME ID1time1 0 73 -0,25 1 -0,25 1 -3,25 1 0 0 0 0 80 1 1 ID1time2 0 77 -0,25 1 -0,5 1 -4 1 0 0 0 0 100 1 2 ID1time3 0 88 -0,25 1 -0,25 1 0 0 0 0 -0,25 1 40 1 3 ID1time4 0 144 -0,5 1 -0,25 1 -2,5 1 0 0 -0,25 1 60 1 4 ID1time5 0 96 -0,5 1 0 0 -2 1 0 0 -0,25 1 60 1 5 ID2time1 0 93 0 0 -0,512820513 0 -0,769230769 1 -13,84615385 1 0 0 61,53846154 1 1 ID2time2 0 81 0 0 0 0 0 0 -7,435897436 1 -0,769230769 1 102,5641026 1 2 ID3time1 0 79 -0,5 1 -0,25 1 0 0 0 0 -0,25 1 80 1 1 ID3time2 0 54 0 0 -0,25 1 -1,25 1 -3 1 0 0 80 1 2 ID3time5 0 67 0 0 0 0 -1 1 -2,5 1 0 0 20 0 5 ID4time1 1 114 . . . . . . . . . . 30 1 1 ID4time4 1 91 0 0 -0,75 1 -1,25 1 -7 1 0 0 40 1 4 ID4time5 1 82 0 0 -1,25 1 -4 1 0 0 0 0 40 1 5 ID5time1 0 85 -0,5 1 -0,5 1 -0,25 1 0 0 -0,5 1 80 1 1 ID5time2 0 59 0 0 -1 1 -1 1 0 0 0 0 80 1 2 ID5time3 0 89 0 0 -1 1 -0,5 1 0 0 0 0 60 1 3 ID5time4 0 104 0 0 -1,25 1 0 0 -7,5 1 0 0 60 1 4
Super User
Posts: 23,776

## Re: Calculate change - novice need help

1. Switch your data to a long format, it's easier to program your logic that way -> PROC TRANSPOSE or a DATA STEP.

https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/

https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/

2. Use LAG to find the difference between the time points

http://support.sas.com/resources/papers/proceedings09/055-2009.pdf

3. Once you have that, you have the data to do your tests, which I think I answered in another post - you can use PROC MEANS to calculate the total change, or you can use PROC NPAR1WAY to test the values.

Occasional Contributor
Posts: 5

## Re: Calculate change - novice need help

Thank you Reeza

I'll try work on it!

Sincerely
Mignon

Discussion stats
• 4 replies
• 94 views
• 2 likes
• 2 in conversation