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

Hi All,

 

Apologies for this basic question just not sure how best to do it.

 

I need to get a unique list of the variable 'Queue' by the variable 'Layer.

 

My data looks like this (has a date range of from 01/08/2017 to current)

 

WEEK_END_DTClusterQueueLayer
8/01/2017FAPADFUnknown
8/01/2017FAPCCBExtended
8/01/2017FAPCSAAssisted
8/01/2017FAPCSAUnknown
8/01/2017FAPCSAUnknown
8/01/2017FAPCSAUnknown
8/01/2017FAPCSAUnknown
8/01/2017FAPCSAUnknown
8/01/2017FAPCSAUnknown
8/01/2017FAPECFUnknown
8/01/2017FAPF04Assisted
8/01/2017FAPF06Extended
8/01/2017FAPF07Unknown
8/01/2017FAPF10General
8/01/2017FAPF13General
8/01/2017FAPF18General
8/01/2017FAPF20General
8/01/2017FAPF21Unknown

 

and would like the output to look like this:

LayerQueue
AssistedCSA
 F04
ExtendedCCB
 F06
GeneralF10
 F13
 F18
 F20
UnknownADF
 CSA
 CSA
 CSA
 CSA
 CSA
 CSA
 ECF
 F07
 F21

 

Hope this makes sense.

 

Cheers

 

Dean

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

PROC SORT with NODUPKEY and/or PROC REPORT. I'm not sure if PROC REPORT will accomplish this directly but I'd try that first, or use PROC SORT and then use that output with PROC REPORT. 

 

Not exactly your question but close:

https://github.com/statgeek/SAS-Tutorials/blob/master/count_distinct_by_group

View solution in original post

3 REPLIES 3
Reeza
Super User

Are you programming or using the GUI? 

 

If GUI select the two columns and check the distinct box. 

Or, look at the sort task, and there's an option for no duplicates which will be the same idea. 

Third - a summary task - but these will give you a count, so you'll know how many fall into each category. 

DME790
Pyrite | Level 9

Hi Reeza,

 

Thanks for the quick response.

 

I'm programming and not sure which Proc to use to get the result. will a proc tabulate do what I need even if it doesn't have a variable?

 

Cheers

Reeza
Super User

PROC SORT with NODUPKEY and/or PROC REPORT. I'm not sure if PROC REPORT will accomplish this directly but I'd try that first, or use PROC SORT and then use that output with PROC REPORT. 

 

Not exactly your question but close:

https://github.com/statgeek/SAS-Tutorials/blob/master/count_distinct_by_group

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1625 views
  • 0 likes
  • 2 in conversation