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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1785 views
  • 0 likes
  • 2 in conversation