BookmarkSubscribeRSS Feed
mackenzies3
Calcite | Level 5

Hello all, 

 

I have a project for a class that asks me to do 3 things 

  • Use PROC TRANSPOSE to restructure the converted SAS data set as described in the Word document
  • Using ARRAY statement to compute the Cmax and Tmax 
  • For each patient, compute the following: MEAN of the concentration values and MINIMUM of the concentration values. 

I have completed all of the tasks correctly, except computing Tmax . 

 

For this part of my project I have:

data temp3;

      set project2_transposed;

      array conc[13] C1-C13;

      Cmax= max(of conc{*});

      array times[13] T1-T13;

      Tmax= max(of times(of Cmax);

      by subject;

run;

 

proc print data= temp3;

title "Part3";

run;

 

I know Tmax is the maximum time from the point where the Concentration is highest. So I thought it would be Tmax = time of Cmax.

Again, Cmax is correct, and I do not get any errors in my log. However, the output numbers from Tmax are incorrect. If anyone could offer any advice I would be grateful.

 

Thank you,

Mackenzie

9 REPLIES 9
PGStats
Opal | Level 21

Hint: look at function WHICHN()

 


@mackenzies3 wrote:

Hello all, 

 

I have a project for a class that asks me to do 3 things 

  • Use PROC TRANSPOSE to restructure the converted SAS data set as described in the Word document
  • Using ARRAY statement to compute the Cmax and Tmax 
  • For each patient, compute the following: MEAN of the concentration values and MINIMUM of the concentration values. 

I have completed all of the tasks correctly, except computing Tmax . 

 

For this part of my project I have:

data temp3;

      set project2_transposed;

      array conc[13] C1-C13;

      Cmax= max(of conc{*});

      array times[13] T1-T13;

      Tmax= max(of times(of Cmax);

      by subject;

run;

 

proc print data= temp3;

title "Part3";

run;

 

I know Tmax is the maximum time from the point where the Concentration is highest. So I thought it would be Tmax = time of Cmax.

Again, Cmax is correct, and I do not get any errors in my log. However, the output numbers from Tmax are incorrect. If anyone could offer any advice I would be grateful.

 

Thank you,

Mackenzie


 

PG
mackenzies3
Calcite | Level 5
Thank you for your hint, but could you please expand a little bit?

I'm very new to sas and we have yet to learn WHICHN() in my class.
PGStats
Opal | Level 21

Learn about it in SAS documentation. All users, experienced or not, look at it every day.

PG
mackenzies3
Calcite | Level 5
I guess I just am having trouble understanding how exactly to go from having the max of the concentration (Cmax), and max of time, to finding the time of the highest concentration (Tmax).

We have 13 times, and 13 concentrations for 7 different subjects.
and the highest time is 32 for all of the subjects, but the highest concentrations differ between each subject.

For instance, subject 1 has the highest concentration of 4.7 at time 2.
but then subject 2 has the highest concentration of 4.7 at time 3.

So I'm very confused on how to make the Tmax = 2 for subject 1, but Tmax = 3 for subject 3 and so on.

And I did look at WHICHN() but I don't even know where I would start with that. But thank you for your hint. I will be looking/trying.
PGStats
Opal | Level 21

Good thinking so far. Since the conc and times arrays correspond elementwise, what you are looking for is the position of cmax in array conc in order to return the corresponding element from array times. Finding the position of cmax in array conc is what WHICHN can do...

PG
ChrisNZ
Tourmaline | Level 20

@PGStats It looks like this forum is more and more about home work. Maybe we're nearing end-of-term / end-of year.

PGStats
Opal | Level 21

I hope the teachers are wise enough to check the forum.

PG
mackenzies3
Calcite | Level 5

It's an online graduate course so we don't have access to traditional teaching settings or in-person help. It's harder to learn solely based on online lectures. The internet is an important tool to help us truly understand. 

PGStats
Opal | Level 21

I'm not the internet! I'm a real person.

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 9 replies
  • 1308 views
  • 0 likes
  • 3 in conversation