BookmarkSubscribeRSS Feed
deleted_user
Not applicable
OK I know zilch about SAS but have a simple problem.
I don’t want to write a lot of code. I just need an application program.
I’m here at Kean University with a simple statistics problem. I want to do some cluster analysis. Here is a typical example:
Starting with this data:

CO2 Levels
Location....20-Nov....21-Nov....22-Nov ....27-Nov ....29-Nov
.....1............19..........19..........20............21...........17
.....2............23..........23..........20............23...........19
.....3............24..........21..........21............23...........17
.....4............22..........21..........20............21...........18
.....5............21..........19..........21............23...........17
.....6............24..........23..........20............23...........21
average = 20.9
Std. Dev. 2.1

How do I get these outputs:

http://i254.photobucket.com/albums/h...sisofCO2_1.jpg

http://i254.photobucket.com/albums/h...sisofCO2_2.jpg

I’d like to expand the table to any size (within the limits of the application) depending on the array size. Can anyone help?
9 REPLIES 9
data_null__
Jade | Level 19
I don't understand your question. If you have the output way do you need the code to produce it? Also this isn't cluster analysis.

[pre]
data co2;
input position @;
do day = 1 to 5;
input co2 @;
output;
end;
cards;
1 19 19 20 21 17
2 23 23 20 23 19
3 24 21 21 23 17
4 22 21 20 21 18
5 21 19 21 23 17
6 24 23 20 23 21
;;;;
run;
proc glm data=co2;
class position day;
model co2 = position day;
means position day / lsd lines;
run;
quit;
[/pre]
deleted_user
Not applicable
Thanks d_n, this is actually a hobby gone slightly out of control.
The problem is whether CO2 varies with time and position in an aquarium regulated with a controller. I reported the data as indicated in the table. Some one else used the data to do the analysis and create the outputs.
The problem is that the data is not normal because it has been skewed using a non linear transformer (exponentiation). When asked to redo the analysis using the untransformed data, the person refused so now I have to do it myself.

As I said, I don’t know anything about SAS but the code reminds me of Basic.

I cannot run the program now since I’m not at school but I have some questions.

Did you run the program? Does it produce the same two outputs?

If I change the size of the array, how do I modify the code to account for this?

Thanks again for your help. I’ll head back to school tomorrow and try to run the program.
RTP
data_null__
Jade | Level 19
> Thanks d_n, this is actually a hobby gone slightly
> out of control.
> The problem is whether CO2 varies with time and
> position in an aquarium regulated with a controller.
> I reported the data as indicated in the table. Some
> one else used the data to do the analysis and create
> the outputs.
> he problem is that the data is not normal because it
> has been skewed using a non linear transformer
> (exponentiation). When asked to redo the analysis
> using the untransformed data, the person refused so
> now I have to do it myself.
>
> As I said, I don’t know anything about SAS but the
> code reminds me of Basic.
Really.
>
> I cannot run the program now since I’m not at school
> but I have some questions.
>
> Did you run the program? Does it produce the same
> two outputs?
yes exactly the same as you posted.

[pre]
The SAS System 58
13:15 Friday, February 27, 2009

Obs position day co2

1 1 1 19
2 1 2 19
3 1 3 20
4 1 4 21
5 1 5 17
6 2 1 23
7 2 2 23
8 2 3 20
9 2 4 23
10 2 5 19
11 3 1 24
12 3 2 21
13 3 3 21
14 3 4 23
15 3 5 17
16 4 1 22
17 4 2 21
18 4 3 20
19 4 4 21
20 4 5 18
21 5 1 21
22 5 2 19
23 5 3 21
24 5 4 23
25 5 5 17
26 6 1 24
27 6 2 23
28 6 3 20
29 6 4 23
30 6 5 21

The SAS System 59
13:15 Friday, February 27, 2009

The GLM Procedure

Class Level Information

Class Levels Values

position 6 1 2 3 4 5 6

day 5 1 2 3 4 5


Number of Observations Read 30
Number of Observations Used 30

The SAS System 60
13:15 Friday, February 27, 2009

The GLM Procedure

Dependent Variable: co2

Sum of
Source DF Squares Mean Square

Model 9 97.6666667 10.8518519

Error 20 25.1333333 1.2566667

Corrected Total 29 122.8000000

Source F Value Pr > F

Model 8.64 <.0001

Error

Corrected Total


R-Square Coeff Var Root MSE co2 Mean

0.795331 5.389478 1.121011 20.80000


Source DF Type I SS Mean Square

position 5 29.20000000 5.84000000
day 4 68.46666667 17.11666667

Source F Value Pr > F

position 4.65 0.0056
day 13.62 <.0001


Source DF Type III SS Mean Square

position 5 29.20000000 5.84000000
day 4 68.46666667 17.11666667

Source F Value Pr > F

position 4.65 0.0056
day 13.62 <.0001

The SAS System 61
13:15 Friday, February 27, 2009

The GLM Procedure

t Tests (LSD) for co2

NOTE: This test controls the Type I comparisonwise error rate,
not the experimentwise error rate.


Alpha 0.05
Error Degrees of Freedom 20
Error Mean Square 1.256667
Critical Value of t 2.08596
Least Significant Difference 1.4789


Means with the same letter are not significantly different.


t Grouping Mean N position

A 22.2000 5 6
A
B A 21.6000 5 2
B A
B A 21.2000 5 3
B
B C 20.4000 5 4
B C
B C 20.2000 5 5
C
C 19.2000 5 1

The SAS System 62
13:15 Friday, February 27, 2009

The GLM Procedure

t Tests (LSD) for co2

NOTE: This test controls the Type I comparisonwise error rate,
not the experimentwise error rate.


Alpha 0.05
Error Degrees of Freedom 20
Error Mean Square 1.256667
Critical Value of t 2.08596
Least Significant Difference 1.3501


Means with the same letter are not significantly different.


t Grouping Mean N day

A 22.3333 6 4
A
A 22.1667 6 1
A
B A 21.0000 6 2
B
B 20.3333 6 3

C 18.1667 6 5

[/pre]


>
> If I change the size of the array, how do I modify
> the code to account for this?
Array? Number of Positions? Number of Days? Not sure what you are referring too. To me array is not the "correct" term here, but that can be resolved easily enough.

If you can post or describe the new data I'm sure "we", the discussion group, can help you.

>
> Thanks again for your help. I’ll head back to school
> tomorrow and try to run the program.
> RTP
deleted_user
Not applicable
OK, I ran it and it seems to compile OK; however, when the program calls GLM I get an error message. Here is the Log:

NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
Licensed to KEAN UNIVERSITY - T&R, Site 0014620003.
NOTE: This session is executing on the XP_PRO platform.



NOTE: SAS initialization used:
real time 2.13 seconds
cpu time 1.15 seconds

1 data co2;
2 input position @;
3 do day = 1 to 5;
4 input co2 @;
5 output;
6 end;
7 cards;

NOTE: The data set WORK.CO2 has 30 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds


14 ;;;;
15 run;
16 proc glm data=co2;
ERROR: Procedure GLM not found.
17 class position day;
18 model co2 = position day;
19 means position day / lsd lines;
20 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

21 quit;





Here is the actual editor display that I input:

data co2;
input position @;
do day = 1 to 5;
input co2 @;
output;
end;
cards;
1 19 19 20 21 17
2 23 23 20 23 19
3 24 21 21 23 17
4 22 21 20 21 18
5 21 19 21 23 17
6 24 23 20 23 21
;;;;
run;
proc glm data=co2;
class position day;
model co2 = position day;
means position day / lsd lines;
run;
quit;





BTW: To me an “n” dimensional data set is an array or a matrix. In the example I used this is a 2 dimensional array (position, day) with size 6 x 5.
It appears to me that the program has the data embedded in the code so that if I try to increase the size of the array to 6 x 10, I would have to re-write the code.
Actually I don’t know for sure, this is just a stupid newbie’s question.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Possibly SAS/Stat is not a licensed SAS component on your system? Use PROC SETINIT to display what components are licensed:

proc setinit;
run;


Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:
You may think of the data as being in an array when you type it in, however, notice that, if you did a PROC PRINT, immediately after your DATA step program, you would see that the data has been internally stored like this:
[pre]
what the data looks like

Obs position day co2

1 1 1 19
2 1 2 19
3 1 3 20
4 1 4 21
5 1 5 17
6 2 1 23
7 2 2 23
8 2 3 20
9 2 4 23
10 2 5 19
11 3 1 24
12 3 2 21
13 3 3 21
14 3 4 23
15 3 5 17
16 4 1 22
17 4 2 21
18 4 3 20
19 4 4 21
20 4 5 18
21 5 1 21
22 5 2 19
23 5 3 21
24 5 4 23
25 5 5 17
26 6 1 24
27 6 2 23
28 6 3 20
29 6 4 23
30 6 5 21

[/pre]

Basically, you have 3 variables, position, day and co2 measurement. If you added more measurement/days, you would then have to change your DO loop.
The data are stored as 1 observation per day and position.

It looks like you were submitting a job on a server that does not have SAS/Stat -- which is why you got that message on the GLM procedure not being found. So, this discussion of the data may be a moot point until you find a server that does have SAS/Stat.

If you added more days, then your PROC GLM code would be the same. It would be your DATA step code that would have to change.

In PROC GLM, you have:
[pre]
class position day;
model co2 = position day;
[/pre]

you could have more days or fewer days, you could have more positions or fewer positions. The data are being analyzed based on the structure in the PROC PRINT view of the data, your model statement and your class statement -- not on how you typed the data for data entry.

cynthia
deleted_user
Not applicable
Thanks Cynthia,

This is interesting:

"You may think of the data as being in an array when you type it in, however, notice that, if you did a PROC PRINT, immediately after your DATA step program, you would see that the data has been internally stored like this:"

I could be wrong but this is actually a very interesting array. The data is in a vector array. Each observation is one dimension and the variables (data) are stored in the second dimension. That allows an “n” dimensional function to be stored as a two dimensional vector array. You learn something new every day! BTW my background is in mathematics and chemistry.

This is not good:

" It looks like you were submitting a job on a server that does not have SAS/Stat, which is why you got that message on the GLM procedure not being found. "

Now this could be a problem. I’m somewhat disappointed that the school paid for a statistics program that cannot resolve a fairly simple statistical problem. Are you sure that there is not some calling function that needs to be activated?

If that is not the case is there a student or demo version of the program that I can down load? SPSS has this.

We are in the middle of a major snow storm here on the east coast; so, school is closed and there is nothing I can do today.
Cynthia_sas
SAS Super FREQ
Hi:
You might be surprised how many companies use SAS without using SAS/STAT. The components are bundled so that companies/schools can get what they need without getting components which will be unused.

It is possible that
1) your school has the SAS/STAT software and either
a) didn't install it on the server you were using or
b) hasn't installed it yet or
c) is doing local installs on an "as needed" basis

Partly, it depends on how SAS is being run. In other words, what kind of license did the school get? Did they get a license for a server copy of the components and the students are using EG as the front end? Did they get a multi-seat license and they install components locally of people's PCs?

If you have a copy of the SAS Learning Edition, for example, then these are the products and procedures available:
http://support.sas.com/learn/le/products.html
http://support.sas.com/learn/le/proc/index.html

To find out whether you have SAS/Stat available, your best bet is to contact the SAS Administrator or person who installed SAS to find out the specifics of how SAS was installed and whether you have the SAS/STAT component available. If you don't know who your SAS Administrator is, then you can work with Tech Support and they can tell you who the contact person is for your school.

cynthia

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
  • 872 views
  • 0 likes
  • 4 in conversation