DOCUMENTATION
  • Software
    • Software
    • SAS Viya
    • Industries
    • Solutions
    • Products
  • Learn
    • Learn
    • Training
    • Certification
    • Academics
    • Books
    • Video Tutorials
  • Support
    • Support
    • Communities
    • Documentation
    • Developers
    • Support & Services
    • User Groups
  • About Us
    • About Us
    • Why SAS?
    • Company
    • Careers
    • Newsroom
    • Events
    • Contact Us
  • Explore
    • Explore
    • Try & Buy
    • Why SAS?
    • Customer Stories
    • Partners
    • Consulting
  • Software
  • SAS Viya
  • Industries
  • Solutions
  • Products
  • Learn
  • Training
  • Certification
  • Academics
  • Books
  • Video Tutorials
  • Support
  • Communities
  • Documentation
  • Developers
  • Support & Services
  • User Groups
  • About Us
  • Why SAS?
  • Company
  • Careers
  • Newsroom
  • Events
  • Contact Us
  • Explore
  • Try & Buy
  • Why SAS?
  • Customer Stories
  • Partners
  • Consulting
  • Contact Us
Sign In

Create Profile

My SAS

Get access to My SAS, trials, communities and more.

SAS Sites

sas.com
Support
Blogs
Communities
Developer
Curiosity
Videos

Documentation

Learn
Brand
PartnerNet
Merchandise
SAS® Help Center
SAS® Viya® Platform Programming Documentation
2026.09
|PDF 
Commentaires
 
  • Welcome to SAS Programming Documentation
  • What's New
  • Learning SAS Viya Platform Programming
  • Syntax Quick Links
  • Python Programming
  • Advanced Analytics
    • Machine Learning
      • Getting Started with Machine Learning
      • Computer Vision Procedures
      • Computer Vision Programming Guide
      • Deep Learning Programming Guide
      • Deep Learning Model Zoo Procedures
      • Deep Learning Model Zoo Programming Guide
      • Machine Learning Procedures
      • Machine Learning Programming Guide
      • NETWORK Procedure
        • Introduction
        • NETWORK Procedure
          • Overview
          • Getting Started
          • Syntax
          • Details
          • Examples
            • Articulation Points in a Terrorist Network
            • Influence Centrality for Project Groups in a Research Department
            • Betweenness and Closeness Centrality for Computer Network Topology
            • Betweenness and Closeness Centrality for Project Groups in a Research Department
            • Eigenvector Centrality for Word Sense Disambiguation
            • Community Detection on Zachary’s Karate Club Data
            • Recursive Community Detection on Zachary’s Karate Club Data
            • Centrality Metrics for an Undirected Graph by Community
            • Cycle Enumeration for Kidney Donor Exchange
            • Transitive Closure for Identification of Circular Dependencies in a Bug Tracking System
            • Reach Networks for Computing the Market Coverage of a Terrorist Network
            • Connected Components for US Patent Citations
            • Shortest Paths of the New York Road Network
            • Shortest Path in a Road Network by Date and Time
            • Pattern Matching in a Social Network
            • Detection of Value-Added Tax Carousel Fraud
            • Node Similarity for Link Prediction
            • A Node Similarity Recipe Recommendation Engine
            • Node Embeddings for Zachary’s Karate Club Data
            • Node Embeddings for European Roads Data
            • Learning Word Embeddings from Synonym Pairs
            • Using Projection to Recommend Recipe Ingredient Pairings
          • References
      • Real-Time Entity and Network Generation Procedures
      • SAS Reinforcement Learning Programming Guide
    • Econometrics
    • SAS Enterprise Miner: High-Performance Procedures
    • Forecasting
    • IML (Interactive Matrix Language)
    • Optimization and Simulation
    • Quality Control
    • Statistics
    • SAS Visual Analytics Programming Guide
    • Text Analytics
  • Data Access
  • Cloud Analytic Services
  • SAS Language Reference
  • Migrating to UTF-8
  • Example Data Sets
  • SAS Code Debugging
  • Output and Graphics
  • In-Database Processing
  • Security and Administration
  • SAS Servers
  • Using the batch Plug-In for the SAS Viya CLI
  • Accessibility on the SAS Viya Platform
  • SAS Data Quality
  • SAS Job Execution Web Application Doc Link
  • SAS Job Execution Web Application
  • SAS Data and AI Studio
  • SAS Visual Analytics
  • SAS Viya Platform: Administration
  • SAS Viya Platform Operations
  • Other Resources
NETWORK Procedure
 

NETWORK Procedure

Overview
Getting Started
Syntax
Details
Examples
References

Example 2.6 Community Detection on Zachary’s Karate Club Data

This example uses Zachary’s Karate Club data (Zachary 1977), which describes social network friendships between 34 members of a karate club at a US university in the 1970s. This is one of the standard publicly available data tables for testing community detection algorithms. It contains 34 nodes and 78 links. The graph is shown in Figure 223.

Figure 223: Zachary’s Karate Club Graph

Zachary’s Karate Club Graph


You can represent the graph by using the following links data table, mylib.LinkSetIn:

data mylib.LinkSetIn;
   input from to @@;
   datalines;
 0  9   0 10   0 14   0 15   0 16   0 19   0 20   0 21
 0 23   0 24   0 27   0 28   0 29   0 30   0 31   0 32
 0 33   2  1   3  1   3  2   4  1   4  2   4  3   5  1
 6  1   7  1   7  5   7  6   8  1   8  2   8  3   8  4
 9  1   9  3  10  3  11  1  11  5  11  6  12  1  13  1
13  4  14  1  14  2  14  3  14  4  17  6  17  7  18  1
18  2  20  1  20  2  22  1  22  2  26 24  26 25  28  3
28 24  28 25  29  3  30 24  30 27  31  2  31  9  32  1
32 25  32 26  32 29  33  3  33  9  33 15  33 16  33 19
33 21  33 23  33 24  33 30  33 31  33 32
;

The following statements use the RESOLUTIONLIST= option to represent resolution levels (1, 0.5) in community detection on the Karate Club data. For more information about resolution levels, see the section Resolution List.

proc network
   links             = mylib.LinkSetIn
   outNodes          = mylib.NodeSetOut;
   community
      resolutionList = 1.0 0.5
      outLevel       = mylib.CommLevelOut
      outCommunity   = mylib.CommOut
      outOverlap     = mylib.CommOverlapOut
      outCommLinks   = mylib.CommLinksOut;
run;

The output data table mylib.NodeSetOut contains the community identifier of each node, as shown in Output 2.6.1.

Output 2.6.1: Community Nodes Output

nodecommunity_1community_2
011
122
222
322
422
532
632
732
822
911
1022
1132
1222
1322
1422
1511
1611
1732
1822
1911
2022
2111
2222
2311
2441
2541
2641
2711
2841
2941
3011
3111
3241
3311


The column community_1 contains the community identifier of each node when the resolution value is 1.0; the column community_2 contains the community identifier of each node when the resolution value is 0.5. Different node colors are used to represent different communities in Figure 224 and Figure 225. As you can see from the figures, four communities at resolution 1.0 are merged into two communities at resolution 0.5.

Figure 224: Karate Club Communities (Resolution = 1.0)

Karate Club Communities (Resolution = 1.0)


Figure 225: Karate Club Communities (Resolution = 0.5)

Karate Club Communities (Resolution = 0.5)


The output data table mylib.CommLevelOut contains the number of communities and the corresponding modularity values found at each resolution level. It is shown in Output 2.6.2.

Output 2.6.2: Community Level Summary Output

levelresolutioncommunitiesmodularity
11.040.41880
20.520.37179


The output data table mylib.CommOut contains the number of nodes in each community, as shown in Output 2.6.3.

Output 2.6.3: Community Number of Nodes Output

levelresolutioncommunitynodesintra_linksinter_linksdensitycut_ratioconductance
11.011120140.363640.0553360.25926
11.021224140.363640.0530300.22581
11.035640.600000.0275860.25000
11.0467100.466670.0595240.41667
20.511734100.250000.0346020.12821
20.521734100.250000.0346020.12821


The output data table mylib.CommOverlapOut contains the intensity of each node that belongs to multiple communities. It is shown in Output 2.6.4. Note that only the communities in the last resolution level (the smallest resolution value) appear as output in this data table. In this example, Node 0 belongs to two communities, with 82.3% of its links connecting to Community 1 and 17.6% of its links connecting to Community 2.

Output 2.6.4: Community Overlap Output

nodecommunityintensity
010.82353
020.17647
110.12500
120.87500
210.11111
220.88889
310.40000
320.60000
421.00000
521.00000
621.00000
721.00000
821.00000
910.60000
920.40000
1010.50000
1020.50000
1121.00000
1221.00000
1321.00000
1410.20000
1420.80000
1511.00000
1611.00000
1721.00000
1821.00000
1911.00000
2010.33333
2020.66667
2111.00000
2221.00000
2311.00000
2411.00000
2511.00000
2611.00000
2711.00000
2810.75000
2820.25000
2910.66667
2920.33333
3011.00000
3110.75000
3120.25000
3210.83333
3220.16667
3310.91667
3320.08333


The output data table mylib.CommLinksOut shows how the communities are interconnected. It is shown in Output 2.6.5. In this example, when the resolution value is 1, the link weight between Communities 1 and 2 is 7, and the link weight between Communities 2 and 3 is 4.

Output 2.6.5: Community Links Output

levelresolutionfrom_communityto_communitylink_weight
11.0127
11.0147
11.0234
11.0243
20.51210


Last updated: August 07, 2026
Confidentialité Conditions d’utilisation 
Copyright © SAS Institute Inc. All Rights Reserved
Ce document est peut-être disponible dans votre langue par défaut. Utilisez le sélecteur de langues dans la barre d’application pour vérifier. Une version antérieure est peut-être disponible dans votre langue par défaut. Utilisez le sélecteur de versions pour changer de version.