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

Hello, I have a dataset with 30k observations. I currently do this operation in excel PivotTables every week but I would love to automate this.

 

The dataset looks something like this: (I can't show the actual dataset for privacy reasons)

date | location | dosages | other_columns_i_want_to_ignore
... 11/17/21 | A | 3 11/17/21 | B | 2
11/17/21 | C | 80 11/18/21 | A | 1 11/18/21 | B | 5
11/18/21 | C | 3 11/19/21 | A | 3 11/19/21 | B | 10
11/19/21 | C | 1
...

I would like to consolidate this into a table like this:

location | dosages |
A | 7
B | 17
C | 84

Thanks again for all your help!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc summary data=have nway;
    class location;
    var dosages;
    output out=want sum=;
run;
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
proc summary data=have nway;
    class location;
    var dosages;
    output out=want sum=;
run;
--
Paige Miller
heyyou1
Fluorite | Level 6
That works amazing! Thank you @PaigeMiller, you have been a lifesaver these past few days.

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