BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Haydo
Obsidian | Level 7

I have the following code:

There are over 50 unique observations in the "type" variable and I'm hoping that someone can have a bit of code that will do this based on the observations as they may vary from month to month (some months there will be 40 and others 40 to 50).

 

proc summary data=work.old_data nway;
  class suburb type;
  var customers ;
  output out=work.new_data sum= ;
run;
Mock Data     
SuburbTypeCustomers  
Suburb1Type150   
Suburb1Type2100   
Suburb1Type32   
Suburb1Type43000   
Suburb1Type5250   
Suburb2Type125   
Suburb2Type235   
Suburb2Type37500   
Suburb2Type41   
Suburb2Type55   
      
Desired Result     
SuburbType1Type2Type3Type4Type5
Suburb15010023000250
Suburb22535750015
1 ACCEPTED SOLUTION
2 REPLIES 2

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 695 views
  • 1 like
  • 2 in conversation