turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Help with maximum and array

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-11-2017 02:11 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mackenzies3

11-11-2017 02:38 PM - edited 11-13-2017 12:06 AM

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:

datatemp3;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;

proctitle "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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

11-11-2017 02:40 PM

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.

I'm very new to sas and we have yet to learn WHICHN() in my class.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mackenzies3

11-11-2017 02:42 PM

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

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

11-11-2017 07:11 PM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mackenzies3

11-11-2017 10:36 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

11-12-2017 11:42 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ChrisNZ

11-13-2017 12:04 AM

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

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ChrisNZ

11-13-2017 12:10 AM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mackenzies3

11-13-2017 12:13 AM

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

PG