- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have a project and I have done every step but I cannot figure out this step....
- For each patient, compute the following: MEAN of the concentration values and MINIMUM of the concentration values.
The professor stated that...
Tmax is not simply the maximum time value. It is the “time value” at which the “maximum drug concentration value” occurs for each person.
This was his feed back to me...
Once you find the CMAX, you are going to use the two arrays: As an example, you would need a statement such as the following with DO and END statements if c{i} = cmax then tmax = t{i}; Hope this helps. I cannot give you anymore hint on this. Prof. Rajaram
HELP!! I have been working on this all week, put multiple hours in to it, contacted the professor, went to a tutor and cannot figure it out. Now it is due tonight... and I have run out of options.
My code
%macro one (v1,v2);
proc import out = &v1
datafile = "\\Client\C$\Users\brian\Desktop\data\&v2"
DBMS = xlsx replace;
getnames = YES;
run;
proc print data= &v1;
run;
%mend one;
%one (Project2, Project2_f17);
proc transpose data= Project2 out=new prefix= T;
by subject;
var time;
run;
proc transpose data= Project2 out=new2 prefix= C;
by subject;
var concentration;
run;
data Project2New;
merge new (drop= _name_ _label_) new2 (drop= _name_ _label_);
by subject;
run;
proc print data= Project2New;
run;
data max_C;
set project2new;
array x[*] c1-c13;
CmaxValue = max(of x[*]);
run;
data max_T;
set project2new;
array y[*] t1-t13;
Do i= 1 to 13;
if c{i}=cmax then tmax={i};
end;
run;
proc print data=max_C;
run;
proc print data=max_T;
run;
proc means data= project2;
var concentration;
run;
I only need help with the mentioned part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Replace the next two steps in your code:
data max_C;
set project2new;
array x[*] c1-c13;
CmaxValue = max(of x[*]);
run;
data max_T;
set project2new;
array y[*] t1-t13;
Do i= 1 to 13;
if c{i}=cmax then tmax={i};
end;
run;
with the next step code:
data want;
set project2new;
array x[*] c1-c13;
array y[*] t1-t13;
Cmax = max(of x[*]);
Do i= 1 to 13;
if x{i} = cmax then tmax = y{i};
end;
run;
proc print data=want; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What happens if there are multiple values of the maximum?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Maybe his?
data MAX_C;
set PROJECT2NEW;
array C[*] C1-C13;
array T[*] T1-T13;
CMAX = max(of C[*]);
do I= 1 to 13;
if C[I]=CMAX then TMAX=T[I];
end;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One of your collegues already asked
https://communities.sas.com/t5/Base-SAS-Programming/Help-with-maximum-and-array/td-p/412594