Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Srishti
Level III

updating rows

I have a jmp table that looks like the picture. Each row with the details are the baseline characteristics of the patients, and the following rows are their data collected at different times. Due to the way data was entered in the software, each patient is in several rows. However, I want to have the baseline characterisitcs , eg, age of patients in all their respective rows (eg, 1 week, 1 month etc). Is there a way to do that? I have thought of making a single row for each patient, but due to the large number of columns, that will be a very cumbersome process.

 

Your help is greatly appreciated! Thanks in advance.

1 REPLY 1
Highlighted
txnelson
Super User

Re: updating rows

This little script should do what you want

Names Default To Here( 1 );
dt = Current Data Table();

For( i = 1, i <= N Rows( dt ), i++,
	If( i == 1,
		hstudy_id = "";
		hdob = .;
		hsex = .;
		hdate_of_x = .;
		hyearx = .;
		hage = .;
	);
	If( :ame[i] == "baseline_arm_1",
		hstudy_id = study_id[i];
		hdob = dob[i];
		hsex = sex[i];
		hdate_of_x = date_of_x[i];
		hyearx = yearx[i];
		hage = age[i];
	,
		study_id[i] = hstudy_id;
		dob[i] = hdob;
		sex[i] = hsex;
		date_of_x[i] = hdate_of_x;
		yearx[i] = hyearx;
		age[i] = hage;
	);
);
Jim
Article Labels

    There are no labels assigned to this post.