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

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:

ObsBird_IDCommon_NameScientific_NameFamilyHabitatRegionMigratory_StatusIUCN_StatusDietSeasonalityState_SymbolProtected_AreaEndemicNocturnalNotesAvg_Wingspan_cmAvg_Weight_gSightings_2023Sightings_2024
11Indian PeafowlPavo cristatusPhasianidaeGrasslandAll_IndiaResidentLCOmnivoreAll_YearNational_BirdYNNCommon around farms and sanctuaries1504000520580
22House SparrowPasser domesticusPasseridaeUrbanAll_IndiaResidentLCGranivoreAll_YearDelhiYNNDeclines in some metros2430720690
33Rose-ringed ParakeetPsittacula krameriPsittaculidaeUrbanNorthResidentLCFrugivoreAll_Year NNNNoisy flocks near parks42120480510
44Black KiteMilvus migransAccipitridaeUrbanAll_IndiaResidentLCCarnivoreAll_Year NNNOften circling over cities150800330355
55Common MynaAcridotheres tristisSturnidaeUrbanAll_IndiaResidentLCOmnivoreAll_Year NNNHighly adaptable40115610640
66Oriental Magpie-RobinCopsychus saularisMuscicapidaeUrbanAll_IndiaResidentLCInsectivoreAll_Year NNNMelodious song3235410450
77Red-vented BulbulPycnonotus caferPycnonotidaeUrbanAll_IndiaResidentLCFrugivoreAll_Year NNNCommon garden bird2840560600
88Greater FlamingoPhoenicopterus roseusPhoenicopteridaeWetlandWestMigrantLCFilter_feederWinterGujaratYNNKutch and Mumbai coasts1603000210320
99Sarus CraneAntigone antigoneGruidaeWetlandNorthResidentVUOmnivoreMonsoonUttar_PradeshYNNTallest flying bird24065006078
1010Painted StorkMycteria leucocephalaCiconiidaeWetlandAll_IndiaResidentNTCarnivoreMonsoon YNNBreeds in heronries1503500140165
1111Asian KoelEudynamys scolopaceusCuculidaeUrbanAll_IndiaResidentLCFrugivoreSummer NNNFamous for 'ko-el' call46200370410
1212Barn OwlTyto albaTytonidaeFarmlandAll_IndiaResidentLCCarnivoreAll_Year NNYNocturnal rodent hunter9545090105
1313Spotted OwletAthene bramaStrigidaeUrbanAll_IndiaResidentLCCarnivoreAll_Year NNYRoosts in cavities60120130150
1414Malabar Pied HornbillAnthracoceros coronatusBucerotidaeForestWestResidentNTFrugivoreMonsoon YNNWestern Ghats specialty12011003036
1515Indian RollerCoracias benghalensisCoraciidaeFarmlandCentralResidentLCCarnivoreAll_YearTelanganaNNNState bird in many states75160260300
1616White-throated KingfisherHalcyon smyrnensisAlcedinidaeWetlandAll_IndiaResidentLCCarnivoreMonsoon NNNCommon near ponds7590420470
1717Purple SunbirdCinnyris asiaticusNectariniidaeUrbanAll_IndiaResidentLCNectarivoreSummer NNNVisits flowers and feeders1810380420
1818Indian PittaPitta brachyuraPittidaeForestSouthResidentLCInsectivoreMonsoon NNNColorful '9-color' bird26755568
1919Laughing DoveSpilopelia senegalensisColumbidaeUrbanAll_IndiaResidentLCGranivoreWinter NNNGentle cooing call45120330370
2020Eurasian Collared-DoveStreptopelia decaoctoColumbidaeFarmlandNorthResidentLCGranivoreWinter NNNExpanding range50190180220


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 NameWORK.BIRDS_INDIAObservations20
Member TypeDATAVariables19
EngineV9Indexes0
Created08/14/2025 18:40:47Observation Length352
Last Modified08/14/2025 18:40:47Deleted Observations0
Protection CompressedNO
Data Set Type SortedNO
Label   
Data RepresentationSOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64  
Encodingutf-8 Unicode (UTF-8)  
Engine/Host Dependent Information
Data Set Page Size131072
Number of Data Set Pages1
First Data Page1
Max Obs per Page372
Obs in First Data Page20
Number of Data Set Repairs0
Filename/saswork/SAS_work497300005C2B_odaws02-apse1-2.oda.sas.com/SAS_work722200005C2B_odaws02-apse1-2.oda.sas.com/birds_india.sas7bdat
Release Created9.0401M8
Host CreatedLinux
Inode Number202278572
Access Permissionrw-r--r--
Owner Nameu63247146
File Size256KB
File Size (bytes)262144
Variables in Creation Order
#VariableTypeLen
1Bird_IDNum8
2Common_NameChar40
3Scientific_NameChar50
4FamilyChar30
5HabitatChar20
6RegionChar15
7Migratory_StatusChar10
8IUCN_StatusChar3
9DietChar20
10SeasonalityChar12
11State_SymbolChar25
12Protected_AreaChar1
13EndemicChar1
14NocturnalChar1
15NotesChar80
16Avg_Wingspan_cmNum8
17Avg_Weight_gNum8
18Sightings_2023Num8
19Sightings_2024Num8

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)

ObsBird_IDCommon_NameScientific_NameFamilyHabitatRegionMigratory_StatusIUCN_StatusDietSeasonalityState_SymbolProtected_AreaEndemicNocturnalNotesAvg_Wingspan_cmAvg_Weight_gSightings_2023Sightings_2024
11Indian PeafowlPavo cristatusPhasianidaeGrassland/SavannaAll_IndiaResidentLeast ConcernOmnivoreAll_YearNational_BirdYesNoNoCommon around farms and sanctuaries1504000520580
22House SparrowPasser domesticusPasseridaeUrban & SuburbanAll_IndiaResidentLeast ConcernGranivoreAll_YearDelhiYesNoNoDeclines in some metros2430720690
33Rose-ringed ParakeetPsittacula krameriPsittaculidaeUrban & SuburbanNorthResidentLeast ConcernFrugivoreAll_Year NoNoNoNoisy flocks near parks42120480510
44Black KiteMilvus migransAccipitridaeUrban & SuburbanAll_IndiaResidentLeast ConcernCarnivoreAll_Year NoNoNoOften circling over cities150800330355
55Common MynaAcridotheres tristisSturnidaeUrban & SuburbanAll_IndiaResidentLeast ConcernOmnivoreAll_Year NoNoNoHighly adaptable40115610640
66Oriental Magpie-RobinCopsychus saularisMuscicapidaeUrban & SuburbanAll_IndiaResidentLeast ConcernInsectivoreAll_Year NoNoNoMelodious song3235410450
77Red-vented BulbulPycnonotus caferPycnonotidaeUrban & SuburbanAll_IndiaResidentLeast ConcernFrugivoreAll_Year NoNoNoCommon garden bird2840560600
88Greater FlamingoPhoenicopterus roseusPhoenicopteridaeWetlands/CoastsWestWinter/Summer MigrantLeast ConcernFilter_feederWinterGujaratYesNoNoKutch and Mumbai coasts1603000210320
99Sarus CraneAntigone antigoneGruidaeWetlands/CoastsNorthResidentVulnerableOmnivoreMonsoonUttar_PradeshYesNoNoTallest flying bird24065006078
1010Painted StorkMycteria leucocephalaCiconiidaeWetlands/CoastsAll_IndiaResidentNear ThreatenedCarnivoreMonsoon YesNoNoBreeds in heronries1503500140165

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

Frequency
Row Pct
Col Pct
Table of Habitat by Region
HabitatRegion
All_IndiaCentralNorthSouthWestTotal
Farmland/Scrub
1
33.33
7.69
1
33.33
100.00
1
33.33
33.33
0
0.00
0.00
0
0.00
0.00
3
 
 
Forest/Woodland
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
1
50.00
100.00
1
50.00
50.00
2
 
 
Grassland/Savanna
1
100.00
7.69
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
1
 
 
Urban & Suburban
9
90.00
69.23
0
0.00
0.00
1
10.00
33.33
0
0.00
0.00
0
0.00
0.00
10
 
 
Wetlands/Coasts
2
50.00
15.38
0
0.00
0.00
1
25.00
33.33
0
0.00
0.00
1
25.00
50.00
4
 
 
Total
13
1
3
1
2
20
IUCN_StatusFrequency
Least Concern17
Near Threatened2
Vulnerable1
Migratory_StatusFrequency
Migrant1
Resident19

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

RegionN ObsVariableNMinimum25th PctlMedian75th PctlMaximumMeanStd Dev
All_India13
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
Central1
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
.
.
.
.
North3
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
South1
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
.
.
.
.
West2
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

ObsHabitatn_speciestotal_2024avg_2024
1Farmland3625208.333
2Forest210452.000
3Grassland1580580.000
4Urban104595459.500
5Wetland41033258.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)

ObsBird_IDCommon_NameRegionHabitatIUCN_StatusSightings_2023Sightings_2024
11Indian PeafowlAll_IndiaGrasslandLeast Concern520580
22House SparrowAll_IndiaUrbanLeast Concern720690
33Rose-ringed ParakeetNorthUrbanLeast Concern480510
44Black KiteAll_IndiaUrbanLeast Concern330355
55Common MynaAll_IndiaUrbanLeast Concern610640
66Oriental Magpie-RobinAll_IndiaUrbanLeast Concern410450
77Red-vented BulbulAll_IndiaUrbanLeast Concern560600
88Greater FlamingoWestWetlandLeast Concern210320
99Sarus CraneNorthWetlandVulnerable6078
1010Painted StorkAll_IndiaWetlandNear Threatened140165
1111Asian KoelAll_IndiaUrbanLeast Concern370410
1212Barn OwlAll_IndiaFarmlandLeast Concern90105
1313Spotted OwletAll_IndiaUrbanLeast Concern130150
1414Malabar Pied HornbillWestForestNear Threatened3036
1515Indian RollerCentralFarmlandLeast Concern260300
1616White-throated KingfisherAll_IndiaWetlandLeast Concern420470
1717Purple SunbirdAll_IndiaUrbanLeast Concern380420
1818Indian PittaSouthForestLeast Concern5568
1919Laughing DoveAll_IndiaUrbanLeast Concern330370
2020Eurasian Collared-DoveNorthFarmlandLeast Concern180220

proc print data=status_by_region label; format IUCN_Status $iucn.; run;

Output:

ObsRegionIUCN_Statusn
1All_IndiaLeast Concern12
2All_IndiaNear Threatened1
3CentralLeast Concern1
4NorthLeast Concern2
5NorthVulnerable1
6SouthLeast Concern1
7WestLeast Concern1
8WestNear Threatened1

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

 RegionAll Regions
All_IndiaCentralNorthSouthWest
Sightings_2024Sightings_2024Sightings_2024Sightings_2024Sightings_2024Sightings_2024
Habitat 111..3
Farmland/ScrubSpecies Count
Mean 2024 Sightings105300220..208
Forest/WoodlandSpecies Count...112
Mean 2024 Sightings...683652
Grassland/SavannaSpecies Count1....1
Mean 2024 Sightings580....580
Urban & SuburbanSpecies Count9.1..10
Mean 2024 Sightings454.510..460
Wetlands/CoastsSpecies Count2.1.14
Mean 2024 Sightings318.78.320258
TotalSpecies Count13131220
Mean 2024 Sightings41630026968178347

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

RegionHabitatCommon_NameIUCN_Status2024 Sightings
All_IndiaFarmland/ScrubBarn OwlLeast Concern105
 Grassland/SavannaIndian PeafowlLeast Concern580
 Urban & SuburbanHouse SparrowLeast Concern690
  Black KiteLeast Concern355
  Common MynaLeast Concern640
  Oriental Magpie-RobinLeast Concern450
  Red-vented BulbulLeast Concern600
  Asian KoelLeast Concern410
  Spotted OwletLeast Concern150
  Purple SunbirdLeast Concern420
  Laughing DoveLeast Concern370
 Wetlands/CoastsPainted StorkNear Threatened165
  White-throated KingfisherLeast Concern470
CentralFarmland/ScrubIndian RollerLeast Concern300
NorthFarmland/ScrubEurasian Collared-DoveLeast Concern220
 Urban & SuburbanRose-ringed ParakeetLeast Concern510
 Wetlands/CoastsSarus CraneVulnerable78
SouthForest/WoodlandIndian PittaLeast Concern68
WestForest/WoodlandMalabar Pied HornbillNear Threatened36
 Wetlands/CoastsGreater FlamingoLeast Concern320
    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)

ObsRegionMigratory_Status_TYPE__FREQ_Total_2024
1All_IndiaResident0135405
2CentralResident01300
3NorthResident03808
4SouthResident0168
5WestMigrant01320
6WestResident0136

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:

ObsRegionResident_2024Migrant_2024
1All_India5405.
2Central300.
3North808.
4South68.
5West36320

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 %)

ObsRank_GrowthCommon_NameRegionHabitatIUCN_StatusSightings_2023Sightings_2024
11House SparrowAll_IndiaUrban & SuburbanLeast Concern720690
22Common MynaAll_IndiaUrban & SuburbanLeast Concern610640
33Red-vented BulbulAll_IndiaUrban & SuburbanLeast Concern560600
44Indian PeafowlAll_IndiaGrassland/SavannaLeast Concern520580
55Rose-ringed ParakeetNorthUrban & SuburbanLeast Concern480510
66White-throated KingfisherAll_IndiaWetlands/CoastsLeast Concern420470
77Oriental Magpie-RobinAll_IndiaUrban & SuburbanLeast Concern410450
88Purple SunbirdAll_IndiaUrban & SuburbanLeast Concern380420
99Asian KoelAll_IndiaUrban & SuburbanLeast Concern370410
1010Laughing DoveAll_IndiaUrban & SuburbanLeast Concern330370
1111Black KiteAll_IndiaUrban & SuburbanLeast Concern330355
1212Greater FlamingoWestWetlands/CoastsLeast Concern210320
1313Indian RollerCentralFarmland/ScrubLeast Concern260300
1414Eurasian Collared-DoveNorthFarmland/ScrubLeast Concern180220
1515Painted StorkAll_IndiaWetlands/CoastsNear Threatened140165

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:






To Visit My Previous E-Commerce Dataset:Click Here
To Visit My Previous Length,Input,Retain Statements:Click Here
To Visit My Previous Urban Traffic Dataset:Click Here
To Visit My Previous Home Energy Consumption Dataset:Click Here





--->PLEASE FOLLOW OUR BLOG FOR MORE INFORMATION.
--->PLEASE DO COMMENTS AND SHARE OUR BLOG.

PLEASE FOLLOW OUR TELEGRAM CHANNEL CLICK HERE

PLEASE FOLLOW OUR FACEBOOK PAGE  CLICK HERE

PLEASE FOLLOW OUR INSTAGRAM PAGE CLICK HERE

Comments