BookmarkSubscribeRSS Feed
briannagowin1
Calcite | Level 5

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. 

4 REPLIES 4
Shmuel
Garnet | Level 18

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;
Reeza
Super User

What happens if there are multiple values of the maximum?

ChrisNZ
Tourmaline | Level 20

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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2927 views
  • 0 likes
  • 5 in conversation