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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 1978 views
  • 0 likes
  • 2 in conversation