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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1941 views
  • 0 likes
  • 2 in conversation