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