BookmarkSubscribeRSS Feed
nika1
Calcite | Level 5

Hi...I am new on SAS communties and I would appreciate help with following data set...I have set with about 14000 IDs regarding specific event that was monitored during 11 years (2010-2020; with different number of IDs per year, for example 1211 IDs in 2010, 1294 in 2011...1007 in 2015, 1105 in 2016,...  ), per each ID I have also season, time of the day when event occured, which species was affected and how many individuals of species was affected or dead...something like this

ID             YEAR       season per year      time of day         species        affected         dead

1               2010         summer                   morning               1                     0                  1

2              2010          autumn                    day                      2                     1                  1

...

1212        2011           spring                      night                   3                     5                   0

1213        2011

...

2033       2012          winter                      morning               1                     3                    1

2034       2013          spring                      morning               2                     0                    1

...

3535      2014          autumn                    night                     3                     2                    5

...

13353    2020          summer                   day                       1                    1                     1

 

I would like test is there significant difference between number and/or frequency of affected and dead animals of different species per year, per season within year, per time of day within season...I would appreciate help and suggestions...thanks!

1 REPLY 1
SASJedi
SAS Super FREQ

Not sure exactly what you are looking for as a result. It it something like this?

data have;
	infile datalines dsd dlm='|' truncover;
	input ID YEAR season:$6. time_of_day:$7. species affected dead;
datalines;
1|2010|spring|night|3|5|0
2|2010|summer|morning|1|0|1
3|2010|autumn|day|2|1|1
4|2010|winter|morning|1|3|1
5|2011|spring|morning|2|0|1
6|2011|autumn|night|3|2|5
7|2011|summer|day|1|1|1
8|2011|winter|morning|1|3|1
;
proc means data=have sum maxdec=0;
  var species affected dead;
  class year;
run;
proc means data=have sum maxdec=0;
  var species affected dead;
  class season;
run;
proc means data=have sum maxdec=0;
  var species affected dead;
  class time_of_day;
run;
YEAR N Obs Variable Sum
2010 4
species
affected
dead
7
9
3
2011 4
species
affected
dead
7
6
8

 

season N Obs Variable Sum
autumn 2
species
affected
dead
5
3
6
spring 2
species
affected
dead
5
5
1
summer 2
species
affected
dead
2
1
2
winter 2
species
affected
dead
2
6
2

time_of_day N Obs Variable Sum
day 2
species
affected
dead
3
2
2
morning 4
species
affected
dead
5
6
4
night 2
species
affected
dead
6
7
5

 

Check out my Jedi SAS Tricks for SAS Users

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 219 views
  • 0 likes
  • 2 in conversation