BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cassylovescats
Calcite | Level 5

Hello,

 

I am creating a code to view the district position and soil type. I wanted to create a count for the soil type so instead of the data being like this:

 

DistrictPosition SoilID SoilName

           S                 838       Prior

           N                 802     Liverpool

           N                 802     Liverpool

           N                 802     Liverpool

           N                 803     Brosnan

 

To this: I need to remove soilname, I am running a dataset with 3775 lines but condensed it to just the 5.

 

DistrictPosition SoilID  Count

           S                 838        1

           N                 802        3

           N                 803        1

 

Hopefully this is possible,

 

I appreciate the help!

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

proc sql;

select DistrictPosition ,SoilID , n(SoilName) as count

from your_data

group by DistrictPosition ,SoilID;

quit;  

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

proc sql;

select DistrictPosition ,SoilID , n(SoilName) as count

from your_data

group by DistrictPosition ,SoilID;

quit;  

cassylovescats
Calcite | Level 5

Thank you! It is extremely appreciated! This is for a final presentation for school.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2465 views
  • 0 likes
  • 2 in conversation