261. BIRDS OF INDIA DATA CREATION | PROC FORMAT | PROC CONTENTS | PROC FREQ | PROC MEANS | PROC SQL | PROC TABULATE | PROC REPORT | PROC TRANSPOSE | PROC RANK | PROC SGPLOT | MACROS IN SAS
- Get link
- X
- Other Apps
BIRDS OF INDIA DATA CREATION | PROC FORMAT | PROC CONTENTS | PROC FREQ | PROC MEANS | PROC SQL | PROC TABULATE | PROC REPORT | PROC TRANSPOSE | PROC RANK | PROC SGPLOT | MACROS IN SAS
/* Creating The Dataset Of Birds of India */
options nodate nonumber formchar="|----|+|---+=|-/\<>*" mprint mlogic symbolgen;
ods listing close;
1) MASTER DATA CREATION
options nocenter;
data birds_india;
length Bird_ID 8 Common_Name $40 Scientific_Name $50 Family $30
Habitat $20 Region $15 Migratory_Status $10 IUCN_Status $3
Diet $20 Seasonality $12 State_Symbol $25
Protected_Area $1 Endemic $1 Nocturnal $1
Notes $80;
infile datalines dsd truncover;
input Bird_ID Common_Name :$40. Scientific_Name :$50. Family :$30.
Habitat :$20. Region :$15. Migratory_Status :$10. IUCN_Status :$3.
Avg_Wingspan_cm Avg_Weight_g Diet :$20. Sightings_2023 Sightings_2024
Protected_Area :$1. Endemic :$1. State_Symbol :$25. Seasonality :$12. Nocturnal :$1. Notes :$80.;
datalines;
1,Indian Peafowl,Pavo cristatus,Phasianidae,Grassland,All_India,Resident,LC,150,4000,Omnivore,520,580,Y,N,National_Bird,All_Year,N,Common around farms and sanctuaries
2,House Sparrow,Passer domesticus,Passeridae,Urban,All_India,Resident,LC,24,30,Granivore,720,690,Y,N,Delhi,All_Year,N,Declines in some metros
3,Rose-ringed Parakeet,Psittacula krameri,Psittaculidae,Urban,North,Resident,LC,42,120,Frugivore,480,510,N,N,,All_Year,N,Noisy flocks near parks
4,Black Kite,Milvus migrans,Accipitridae,Urban,All_India,Resident,LC,150,800,Carnivore,330,355,N,N,,All_Year,N,Often circling over cities
5,Common Myna,Acridotheres tristis,Sturnidae,Urban,All_India,Resident,LC,40,115,Omnivore,610,640,N,N,,All_Year,N,Highly adaptable
6,Oriental Magpie-Robin,Copsychus saularis,Muscicapidae,Urban,All_India,Resident,LC,32,35,Insectivore,410,450,N,N,,All_Year,N,Melodious song
7,Red-vented Bulbul,Pycnonotus cafer,Pycnonotidae,Urban,All_India,Resident,LC,28,40,Frugivore,560,600,N,N,,All_Year,N,Common garden bird
8,Greater Flamingo,Phoenicopterus roseus,Phoenicopteridae,Wetland,West,Migrant,LC,160,3000,Filter_feeder,210,320,Y,N,Gujarat,Winter,N,Kutch and Mumbai coasts
9,Sarus Crane,Antigone antigone,Gruidae,Wetland,North,Resident,VU,240,6500,Omnivore,60,78,Y,N,Uttar_Pradesh,Monsoon,N,Tallest flying bird
10,Painted Stork,Mycteria leucocephala,Ciconiidae,Wetland,All_India,Resident,NT,150,3500,Carnivore,140,165,Y,N,,Monsoon,N,Breeds in heronries
11,Asian Koel,Eudynamys scolopaceus,Cuculidae,Urban,All_India,Resident,LC,46,200,Frugivore,370,410,N,N,,Summer,N,Famous for 'ko-el' call
12,Barn Owl,Tyto alba,Tytonidae,Farmland,All_India,Resident,LC,95,450,Carnivore,90,105,N,N,,All_Year,Y,Nocturnal rodent hunter
13,Spotted Owlet,Athene brama,Strigidae,Urban,All_India,Resident,LC,60,120,Carnivore,130,150,N,N,,All_Year,Y,Roosts in cavities
14,Malabar Pied Hornbill,Anthracoceros coronatus,Bucerotidae,Forest,West,Resident,NT,120,1100,Frugivore,30,36,Y,N,,Monsoon,N,Western Ghats specialty
15,Indian Roller,Coracias benghalensis,Coraciidae,Farmland,Central,Resident,LC,75,160,Carnivore,260,300,N,N,Telangana,All_Year,N,State bird in many states
16,White-throated Kingfisher,Halcyon smyrnensis,Alcedinidae,Wetland,All_India,Resident,LC,75,90,Carnivore,420,470,N,N,,Monsoon,N,Common near ponds
17,Purple Sunbird,Cinnyris asiaticus,Nectariniidae,Urban,All_India,Resident,LC,18,10,Nectarivore,380,420,N,N,,Summer,N,Visits flowers and feeders
18,Indian Pitta,Pitta brachyura,Pittidae,Forest,South,Resident,LC,26,75,Insectivore,55,68,N,N,,Monsoon,N,Colorful '9-color' bird
19,Laughing Dove,Spilopelia senegalensis,Columbidae,Urban,All_India,Resident,LC,45,120,Granivore,330,370,N,N,,Winter,N,Gentle cooing call
20,Eurasian Collared-Dove,Streptopelia decaocto,Columbidae,Farmland,North,Resident,LC,50,190,Granivore,180,220,N,N,,Winter,N,Expanding range
;
run;
proc print;run;
Output:
Obs | Bird_ID | Common_Name | Scientific_Name | Family | Habitat | Region | Migratory_Status | IUCN_Status | Diet | Seasonality | State_Symbol | Protected_Area | Endemic | Nocturnal | Notes | Avg_Wingspan_cm | Avg_Weight_g | Sightings_2023 | Sightings_2024 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | Indian Peafowl | Pavo cristatus | Phasianidae | Grassland | All_India | Resident | LC | Omnivore | All_Year | National_Bird | Y | N | N | Common around farms and sanctuaries | 150 | 4000 | 520 | 580 |
2 | 2 | House Sparrow | Passer domesticus | Passeridae | Urban | All_India | Resident | LC | Granivore | All_Year | Delhi | Y | N | N | Declines in some metros | 24 | 30 | 720 | 690 |
3 | 3 | Rose-ringed Parakeet | Psittacula krameri | Psittaculidae | Urban | North | Resident | LC | Frugivore | All_Year | N | N | N | Noisy flocks near parks | 42 | 120 | 480 | 510 | |
4 | 4 | Black Kite | Milvus migrans | Accipitridae | Urban | All_India | Resident | LC | Carnivore | All_Year | N | N | N | Often circling over cities | 150 | 800 | 330 | 355 | |
5 | 5 | Common Myna | Acridotheres tristis | Sturnidae | Urban | All_India | Resident | LC | Omnivore | All_Year | N | N | N | Highly adaptable | 40 | 115 | 610 | 640 | |
6 | 6 | Oriental Magpie-Robin | Copsychus saularis | Muscicapidae | Urban | All_India | Resident | LC | Insectivore | All_Year | N | N | N | Melodious song | 32 | 35 | 410 | 450 | |
7 | 7 | Red-vented Bulbul | Pycnonotus cafer | Pycnonotidae | Urban | All_India | Resident | LC | Frugivore | All_Year | N | N | N | Common garden bird | 28 | 40 | 560 | 600 | |
8 | 8 | Greater Flamingo | Phoenicopterus roseus | Phoenicopteridae | Wetland | West | Migrant | LC | Filter_feeder | Winter | Gujarat | Y | N | N | Kutch and Mumbai coasts | 160 | 3000 | 210 | 320 |
9 | 9 | Sarus Crane | Antigone antigone | Gruidae | Wetland | North | Resident | VU | Omnivore | Monsoon | Uttar_Pradesh | Y | N | N | Tallest flying bird | 240 | 6500 | 60 | 78 |
10 | 10 | Painted Stork | Mycteria leucocephala | Ciconiidae | Wetland | All_India | Resident | NT | Carnivore | Monsoon | Y | N | N | Breeds in heronries | 150 | 3500 | 140 | 165 | |
11 | 11 | Asian Koel | Eudynamys scolopaceus | Cuculidae | Urban | All_India | Resident | LC | Frugivore | Summer | N | N | N | Famous for 'ko-el' call | 46 | 200 | 370 | 410 | |
12 | 12 | Barn Owl | Tyto alba | Tytonidae | Farmland | All_India | Resident | LC | Carnivore | All_Year | N | N | Y | Nocturnal rodent hunter | 95 | 450 | 90 | 105 | |
13 | 13 | Spotted Owlet | Athene brama | Strigidae | Urban | All_India | Resident | LC | Carnivore | All_Year | N | N | Y | Roosts in cavities | 60 | 120 | 130 | 150 | |
14 | 14 | Malabar Pied Hornbill | Anthracoceros coronatus | Bucerotidae | Forest | West | Resident | NT | Frugivore | Monsoon | Y | N | N | Western Ghats specialty | 120 | 1100 | 30 | 36 | |
15 | 15 | Indian Roller | Coracias benghalensis | Coraciidae | Farmland | Central | Resident | LC | Carnivore | All_Year | Telangana | N | N | N | State bird in many states | 75 | 160 | 260 | 300 |
16 | 16 | White-throated Kingfisher | Halcyon smyrnensis | Alcedinidae | Wetland | All_India | Resident | LC | Carnivore | Monsoon | N | N | N | Common near ponds | 75 | 90 | 420 | 470 | |
17 | 17 | Purple Sunbird | Cinnyris asiaticus | Nectariniidae | Urban | All_India | Resident | LC | Nectarivore | Summer | N | N | N | Visits flowers and feeders | 18 | 10 | 380 | 420 | |
18 | 18 | Indian Pitta | Pitta brachyura | Pittidae | Forest | South | Resident | LC | Insectivore | Monsoon | N | N | N | Colorful '9-color' bird | 26 | 75 | 55 | 68 | |
19 | 19 | Laughing Dove | Spilopelia senegalensis | Columbidae | Urban | All_India | Resident | LC | Granivore | Winter | N | N | N | Gentle cooing call | 45 | 120 | 330 | 370 | |
20 | 20 | Eurasian Collared-Dove | Streptopelia decaocto | Columbidae | Farmland | North | Resident | LC | Granivore | Winter | N | N | N | Expanding range | 50 | 190 | 180 | 220 |
2) FORMATS FOR CLEAN OUTPUT
proc format;
value $iucn
'LC'='Least Concern'
'NT'='Near Threatened'
'VU'='Vulnerable'
'EN'='Endangered'
'CR'='Critically Endangered';
value $mig
'Resident'='Resident'
'Migrant' ='Winter/Summer Migrant';
value $hab
'Urban' ='Urban & Suburban'
'Wetland' ='Wetlands/Coasts'
'Forest' ='Forest/Woodland'
'Farmland' ='Farmland/Scrub'
'Grassland'='Grassland/Savanna'
'Coastal' ='Coastal/Estuarine'
'Cliffs' ='Cliffs/Rocky';
value $yn 'Y'='Yes' 'N'='No';
run;
3) QUICK STRUCTURE & SAMPLE
title1 "BIRDS OF INDIA | PROC CONTENTS";
proc contents data=birds_india order=varnum;
run;
Output:
BIRDS OF INDIA | PROC CONTENTS
The CONTENTS Procedure
Data Set Name | WORK.BIRDS_INDIA | Observations | 20 |
---|---|---|---|
Member Type | DATA | Variables | 19 |
Engine | V9 | Indexes | 0 |
Created | 08/14/2025 18:40:47 | Observation Length | 352 |
Last Modified | 08/14/2025 18:40:47 | Deleted Observations | 0 |
Protection | Compressed | NO | |
Data Set Type | Sorted | NO | |
Label | |||
Data Representation | SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64 | ||
Encoding | utf-8 Unicode (UTF-8) |
Engine/Host Dependent Information | |
---|---|
Data Set Page Size | 131072 |
Number of Data Set Pages | 1 |
First Data Page | 1 |
Max Obs per Page | 372 |
Obs in First Data Page | 20 |
Number of Data Set Repairs | 0 |
Filename | /saswork/SAS_work497300005C2B_odaws02-apse1-2.oda.sas.com/SAS_work722200005C2B_odaws02-apse1-2.oda.sas.com/birds_india.sas7bdat |
Release Created | 9.0401M8 |
Host Created | Linux |
Inode Number | 202278572 |
Access Permission | rw-r--r-- |
Owner Name | u63247146 |
File Size | 256KB |
File Size (bytes) | 262144 |
Variables in Creation Order | |||
---|---|---|---|
# | Variable | Type | Len |
1 | Bird_ID | Num | 8 |
2 | Common_Name | Char | 40 |
3 | Scientific_Name | Char | 50 |
4 | Family | Char | 30 |
5 | Habitat | Char | 20 |
6 | Region | Char | 15 |
7 | Migratory_Status | Char | 10 |
8 | IUCN_Status | Char | 3 |
9 | Diet | Char | 20 |
10 | Seasonality | Char | 12 |
11 | State_Symbol | Char | 25 |
12 | Protected_Area | Char | 1 |
13 | Endemic | Char | 1 |
14 | Nocturnal | Char | 1 |
15 | Notes | Char | 80 |
16 | Avg_Wingspan_cm | Num | 8 |
17 | Avg_Weight_g | Num | 8 |
18 | Sightings_2023 | Num | 8 |
19 | Sightings_2024 | Num | 8 |
title1 "BIRDS OF INDIA | PROC PRINT (FIRST 10)";
proc print data=birds_india(obs=10) label;
format IUCN_Status $iucn. Migratory_Status $mig. Habitat $hab.
Protected_Area Endemic Nocturnal $yn.;
run;
Output:
BIRDS OF INDIA | PROC PRINT (FIRST 10)
Obs | Bird_ID | Common_Name | Scientific_Name | Family | Habitat | Region | Migratory_Status | IUCN_Status | Diet | Seasonality | State_Symbol | Protected_Area | Endemic | Nocturnal | Notes | Avg_Wingspan_cm | Avg_Weight_g | Sightings_2023 | Sightings_2024 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | Indian Peafowl | Pavo cristatus | Phasianidae | Grassland/Savanna | All_India | Resident | Least Concern | Omnivore | All_Year | National_Bird | Yes | No | No | Common around farms and sanctuaries | 150 | 4000 | 520 | 580 |
2 | 2 | House Sparrow | Passer domesticus | Passeridae | Urban & Suburban | All_India | Resident | Least Concern | Granivore | All_Year | Delhi | Yes | No | No | Declines in some metros | 24 | 30 | 720 | 690 |
3 | 3 | Rose-ringed Parakeet | Psittacula krameri | Psittaculidae | Urban & Suburban | North | Resident | Least Concern | Frugivore | All_Year | No | No | No | Noisy flocks near parks | 42 | 120 | 480 | 510 | |
4 | 4 | Black Kite | Milvus migrans | Accipitridae | Urban & Suburban | All_India | Resident | Least Concern | Carnivore | All_Year | No | No | No | Often circling over cities | 150 | 800 | 330 | 355 | |
5 | 5 | Common Myna | Acridotheres tristis | Sturnidae | Urban & Suburban | All_India | Resident | Least Concern | Omnivore | All_Year | No | No | No | Highly adaptable | 40 | 115 | 610 | 640 | |
6 | 6 | Oriental Magpie-Robin | Copsychus saularis | Muscicapidae | Urban & Suburban | All_India | Resident | Least Concern | Insectivore | All_Year | No | No | No | Melodious song | 32 | 35 | 410 | 450 | |
7 | 7 | Red-vented Bulbul | Pycnonotus cafer | Pycnonotidae | Urban & Suburban | All_India | Resident | Least Concern | Frugivore | All_Year | No | No | No | Common garden bird | 28 | 40 | 560 | 600 | |
8 | 8 | Greater Flamingo | Phoenicopterus roseus | Phoenicopteridae | Wetlands/Coasts | West | Winter/Summer Migrant | Least Concern | Filter_feeder | Winter | Gujarat | Yes | No | No | Kutch and Mumbai coasts | 160 | 3000 | 210 | 320 |
9 | 9 | Sarus Crane | Antigone antigone | Gruidae | Wetlands/Coasts | North | Resident | Vulnerable | Omnivore | Monsoon | Uttar_Pradesh | Yes | No | No | Tallest flying bird | 240 | 6500 | 60 | 78 |
10 | 10 | Painted Stork | Mycteria leucocephala | Ciconiidae | Wetlands/Coasts | All_India | Resident | Near Threatened | Carnivore | Monsoon | Yes | No | No | Breeds in heronries | 150 | 3500 | 140 | 165 |
4) DESCRIPTIVE STATS
title1 "BIRDS OF INDIA | PROC FREQ";
proc freq data=birds_india;
tables Habitat*Region IUCN_Status Migratory_Status / nocum nopercent;
format IUCN_Status $iucn. Habitat $hab.;
run;
Output:
BIRDS OF INDIA | PROC FREQ
The FREQ Procedure
|
|
IUCN_Status | Frequency |
---|---|
Least Concern | 17 |
Near Threatened | 2 |
Vulnerable | 1 |
Migratory_Status | Frequency |
---|---|
Migrant | 1 |
Resident | 19 |
title1 "BIRDS OF INDIA | PROC MEANS";
proc means data=birds_india n min p25 median p75 max mean std maxdec=1;
class Region;
var Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 ;
run;
Output:
BIRDS OF INDIA | PROC MEANS
The MEANS Procedure
Region | N Obs | Variable | N | Minimum | 25th Pctl | Median | 75th Pctl | Maximum | Mean | Std Dev |
---|---|---|---|---|---|---|---|---|---|---|
All_India | 13 | Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 | 13 13 13 13 | 18.0 10.0 90.0 105.0 | 32.0 40.0 330.0 355.0 | 46.0 120.0 380.0 420.0 | 95.0 450.0 520.0 580.0 | 150.0 4000.0 720.0 690.0 | 70.2 731.5 385.4 415.8 | 50.1 1361.1 189.7 188.5 |
Central | 1 | Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 | 1 1 1 1 | 75.0 160.0 260.0 300.0 | 75.0 160.0 260.0 300.0 | 75.0 160.0 260.0 300.0 | 75.0 160.0 260.0 300.0 | 75.0 160.0 260.0 300.0 | 75.0 160.0 260.0 300.0 | . . . . |
North | 3 | Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 | 3 3 3 3 | 42.0 120.0 60.0 78.0 | 42.0 120.0 60.0 78.0 | 50.0 190.0 180.0 220.0 | 240.0 6500.0 480.0 510.0 | 240.0 6500.0 480.0 510.0 | 110.7 2270.0 240.0 269.3 | 112.1 3663.5 216.3 220.2 |
South | 1 | Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 | 1 1 1 1 | 26.0 75.0 55.0 68.0 | 26.0 75.0 55.0 68.0 | 26.0 75.0 55.0 68.0 | 26.0 75.0 55.0 68.0 | 26.0 75.0 55.0 68.0 | 26.0 75.0 55.0 68.0 | . . . . |
West | 2 | Avg_Wingspan_cm Avg_Weight_g Sightings_2023 Sightings_2024 | 2 2 2 2 | 120.0 1100.0 30.0 36.0 | 120.0 1100.0 30.0 36.0 | 140.0 2050.0 120.0 178.0 | 160.0 3000.0 210.0 320.0 | 160.0 3000.0 210.0 320.0 | 140.0 2050.0 120.0 178.0 | 28.3 1343.5 127.3 200.8 |
5) SQL SUMMARIES & VIEWS
title1 "BIRDS OF INDIA | PROC SQL";
proc sql;
create view vw_habitat_summary as
select Habitat,
count(*) as n_species,
sum(Sightings_2024) as total_2024,
calculated total_2024*1.0/count(*) as avg_2024
from birds_india
group by Habitat;
create table top_growth as
select Bird_ID, Common_Name, Region, Habitat, IUCN_Status, Sightings_2023, Sightings_2024
from birds_india
where Sightings_2023>=20;
create table status_by_region as
select Region, IUCN_Status, count(*) as n
from birds_india
group by Region, IUCN_Status;
quit;
title2 "Habitat Summary View — Preview";
proc print data=vw_habitat_summary(obs=10) label; format ; run;
Output:
Habitat Summary View — Preview
Obs | Habitat | n_species | total_2024 | avg_2024 |
---|---|---|---|---|
1 | Farmland | 3 | 625 | 208.333 |
2 | Forest | 2 | 104 | 52.000 |
3 | Grassland | 1 | 580 | 580.000 |
4 | Urban | 10 | 4595 | 459.500 |
5 | Wetland | 4 | 1033 | 258.250 |
title2 "Top Growth (where 2023 sightings >=20)";
proc print data=top_growth label; format IUCN_Status $iucn.; run;
Output:
Top Growth (where 2023 sightings >=20)
Obs | Bird_ID | Common_Name | Region | Habitat | IUCN_Status | Sightings_2023 | Sightings_2024 |
---|---|---|---|---|---|---|---|
1 | 1 | Indian Peafowl | All_India | Grassland | Least Concern | 520 | 580 |
2 | 2 | House Sparrow | All_India | Urban | Least Concern | 720 | 690 |
3 | 3 | Rose-ringed Parakeet | North | Urban | Least Concern | 480 | 510 |
4 | 4 | Black Kite | All_India | Urban | Least Concern | 330 | 355 |
5 | 5 | Common Myna | All_India | Urban | Least Concern | 610 | 640 |
6 | 6 | Oriental Magpie-Robin | All_India | Urban | Least Concern | 410 | 450 |
7 | 7 | Red-vented Bulbul | All_India | Urban | Least Concern | 560 | 600 |
8 | 8 | Greater Flamingo | West | Wetland | Least Concern | 210 | 320 |
9 | 9 | Sarus Crane | North | Wetland | Vulnerable | 60 | 78 |
10 | 10 | Painted Stork | All_India | Wetland | Near Threatened | 140 | 165 |
11 | 11 | Asian Koel | All_India | Urban | Least Concern | 370 | 410 |
12 | 12 | Barn Owl | All_India | Farmland | Least Concern | 90 | 105 |
13 | 13 | Spotted Owlet | All_India | Urban | Least Concern | 130 | 150 |
14 | 14 | Malabar Pied Hornbill | West | Forest | Near Threatened | 30 | 36 |
15 | 15 | Indian Roller | Central | Farmland | Least Concern | 260 | 300 |
16 | 16 | White-throated Kingfisher | All_India | Wetland | Least Concern | 420 | 470 |
17 | 17 | Purple Sunbird | All_India | Urban | Least Concern | 380 | 420 |
18 | 18 | Indian Pitta | South | Forest | Least Concern | 55 | 68 |
19 | 19 | Laughing Dove | All_India | Urban | Least Concern | 330 | 370 |
20 | 20 | Eurasian Collared-Dove | North | Farmland | Least Concern | 180 | 220 |
proc print data=status_by_region label; format IUCN_Status $iucn.; run;
Output:
Obs | Region | IUCN_Status | n |
---|---|---|---|
1 | All_India | Least Concern | 12 |
2 | All_India | Near Threatened | 1 |
3 | Central | Least Concern | 1 |
4 | North | Least Concern | 2 |
5 | North | Vulnerable | 1 |
6 | South | Least Concern | 1 |
7 | West | Least Concern | 1 |
8 | West | Near Threatened | 1 |
6) TABULATE & REPORT
title1 "BIRDS OF INDIA | PROC TABULATE";
proc tabulate data=birds_india format=8.;
class Habitat Region;
var Sightings_2024;
table (Habitat all='Total')*(n='Species Count' mean='Mean 2024 Sightings'),
(Region all='All Regions')*Sightings_2024;
format Habitat $hab.;
run;
Output:
BIRDS OF INDIA | PROC TABULATE
Region | All Regions | ||||||
---|---|---|---|---|---|---|---|
All_India | Central | North | South | West | |||
Sightings_2024 | Sightings_2024 | Sightings_2024 | Sightings_2024 | Sightings_2024 | Sightings_2024 | ||
Habitat | 1 | 1 | 1 | . | . | 3 | |
Farmland/Scrub | Species Count | ||||||
Mean 2024 Sightings | 105 | 300 | 220 | . | . | 208 | |
Forest/Woodland | Species Count | . | . | . | 1 | 1 | 2 |
Mean 2024 Sightings | . | . | . | 68 | 36 | 52 | |
Grassland/Savanna | Species Count | 1 | . | . | . | . | 1 |
Mean 2024 Sightings | 580 | . | . | . | . | 580 | |
Urban & Suburban | Species Count | 9 | . | 1 | . | . | 10 |
Mean 2024 Sightings | 454 | . | 510 | . | . | 460 | |
Wetlands/Coasts | Species Count | 2 | . | 1 | . | 1 | 4 |
Mean 2024 Sightings | 318 | . | 78 | . | 320 | 258 | |
Total | Species Count | 13 | 1 | 3 | 1 | 2 | 20 |
Mean 2024 Sightings | 416 | 300 | 269 | 68 | 178 | 347 |
title1 "BIRDS OF INDIA | PROC REPORT";
proc report data=birds_india nowd;
column Region Habitat Common_Name IUCN_Status Sightings_2024 Growth_Pct;
define Region / group;
define Habitat / group format=$hab.;
define Common_Name / display;
define IUCN_Status / display format=$iucn.;
define Sightings_2024 / analysis sum '2024 Sightings';
define Growth_Pct / analysis mean format=6.1 'Avg Growth %';
rbreak after / summarize dol skip;
run;
Output:
BIRDS OF INDIA | PROC REPORT
Region | Habitat | Common_Name | IUCN_Status | 2024 Sightings |
---|---|---|---|---|
All_India | Farmland/Scrub | Barn Owl | Least Concern | 105 |
Grassland/Savanna | Indian Peafowl | Least Concern | 580 | |
Urban & Suburban | House Sparrow | Least Concern | 690 | |
Black Kite | Least Concern | 355 | ||
Common Myna | Least Concern | 640 | ||
Oriental Magpie-Robin | Least Concern | 450 | ||
Red-vented Bulbul | Least Concern | 600 | ||
Asian Koel | Least Concern | 410 | ||
Spotted Owlet | Least Concern | 150 | ||
Purple Sunbird | Least Concern | 420 | ||
Laughing Dove | Least Concern | 370 | ||
Wetlands/Coasts | Painted Stork | Near Threatened | 165 | |
White-throated Kingfisher | Least Concern | 470 | ||
Central | Farmland/Scrub | Indian Roller | Least Concern | 300 |
North | Farmland/Scrub | Eurasian Collared-Dove | Least Concern | 220 |
Urban & Suburban | Rose-ringed Parakeet | Least Concern | 510 | |
Wetlands/Coasts | Sarus Crane | Vulnerable | 78 | |
South | Forest/Woodland | Indian Pitta | Least Concern | 68 |
West | Forest/Woodland | Malabar Pied Hornbill | Near Threatened | 36 |
Wetlands/Coasts | Greater Flamingo | Least Concern | 320 | |
6937 |
7)PROC TRANSPOSE
title1 "BIRDS OF INDIA | PROC TRANSPOSE (Pivot 2024 by Migratory Status)";
proc sort data=birds_india out=birds_sorted; by Region Migratory_Status; run;
proc means noprint data=birds_sorted;
by Region Migratory_Status;
var Sightings_2024;
output out=agg_2024 sum=Total_2024;
run;
proc print data=agg_2024;run;
Output:
BIRDS OF INDIA | PROC TRANSPOSE (Pivot 2024 by Migratory Status)
Obs | Region | Migratory_Status | _TYPE_ | _FREQ_ | Total_2024 |
---|---|---|---|---|---|
1 | All_India | Resident | 0 | 13 | 5405 |
2 | Central | Resident | 0 | 1 | 300 |
3 | North | Resident | 0 | 3 | 808 |
4 | South | Resident | 0 | 1 | 68 |
5 | West | Migrant | 0 | 1 | 320 |
6 | West | Resident | 0 | 1 | 36 |
proc transpose data=agg_2024 out=pivot_2024(drop=_name_) prefix=MS_;
by Region;
id Migratory_Status;
var Total_2024;
run;
proc print data=pivot_2024 label; label MS_Migrant="Migrant_2024" MS_Resident="Resident_2024"; run;
Output:
Obs | Region | Resident_2024 | Migrant_2024 |
---|---|---|---|
1 | All_India | 5405 | . |
2 | Central | 300 | . |
3 | North | 808 | . |
4 | South | 68 | . |
5 | West | 36 | 320 |
8) RANKING EXERCISE
title1 "BIRDS OF INDIA | PROC RANK (By Growth %)";
proc rank data=birds_india out=ranked_growth ties=low descending;
var Sightings_2024;
ranks Rank_Growth;
run;
proc sort data=ranked_growth; by Rank_Growth; run;
proc print data=ranked_growth(obs=15);
var Rank_Growth Common_Name Region Habitat IUCN_Status Sightings_2023 Sightings_2024 ;
format IUCN_Status $iucn. Habitat $hab.;
run;
Output:
BIRDS OF INDIA | PROC RANK (By Growth %)
Obs | Rank_Growth | Common_Name | Region | Habitat | IUCN_Status | Sightings_2023 | Sightings_2024 |
---|---|---|---|---|---|---|---|
1 | 1 | House Sparrow | All_India | Urban & Suburban | Least Concern | 720 | 690 |
2 | 2 | Common Myna | All_India | Urban & Suburban | Least Concern | 610 | 640 |
3 | 3 | Red-vented Bulbul | All_India | Urban & Suburban | Least Concern | 560 | 600 |
4 | 4 | Indian Peafowl | All_India | Grassland/Savanna | Least Concern | 520 | 580 |
5 | 5 | Rose-ringed Parakeet | North | Urban & Suburban | Least Concern | 480 | 510 |
6 | 6 | White-throated Kingfisher | All_India | Wetlands/Coasts | Least Concern | 420 | 470 |
7 | 7 | Oriental Magpie-Robin | All_India | Urban & Suburban | Least Concern | 410 | 450 |
8 | 8 | Purple Sunbird | All_India | Urban & Suburban | Least Concern | 380 | 420 |
9 | 9 | Asian Koel | All_India | Urban & Suburban | Least Concern | 370 | 410 |
10 | 10 | Laughing Dove | All_India | Urban & Suburban | Least Concern | 330 | 370 |
11 | 11 | Black Kite | All_India | Urban & Suburban | Least Concern | 330 | 355 |
12 | 12 | Greater Flamingo | West | Wetlands/Coasts | Least Concern | 210 | 320 |
13 | 13 | Indian Roller | Central | Farmland/Scrub | Least Concern | 260 | 300 |
14 | 14 | Eurasian Collared-Dove | North | Farmland/Scrub | Least Concern | 180 | 220 |
15 | 15 | Painted Stork | All_India | Wetlands/Coasts | Near Threatened | 140 | 165 |
9) BASIC GRAPHICS
ods graphics on;
title1 "BIRDS OF INDIA | PROC SGPLOT (Top 10 by Growth %)";
proc sort data=top_growth out=top10; by descending Growth_Pct; run;
data top10; set top10(obs=10); length label $60; label=cats(Common_Name,' (',Region,')'); run;
proc sgplot data=top10;
vbar label / response=Growth_Pct datalabel;
yaxis label="Growth % (2024 vs 2023)";
xaxis discreteorder=data label="Species (Region)";
run;
Output:
title1 "BIRDS OF INDIA | PROC SGPLOT (Species per Habitat)";
proc sql;
create table habitat_counts as
select Habitat, count(*) as n_species
from birds_india
group by Habitat;
quit;
proc sgplot data=habitat_counts;
vbar Habitat / response=n_species datalabel;
xaxis label="Habitat"; yaxis label="Number of Species";
format Habitat $hab.;
run;
Output:
- Get link
- X
- Other Apps
Comments
Post a Comment