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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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