BookmarkSubscribeRSS Feed
Neil_C
Calcite | Level 5

I have the data in format below:

 

id  group Sales Country1 Country2......  Region1 Region2.......

1     1         200   USA        Canada     East    South

2     1         300   USA        UK            West    North

3     2         400 ............

 

 

I have to equally distribute Sales based on the number of Country as well do the same for Regions; and then create a matrix on the sum of Sales with Country on the Row and Regions on the Columns.

 

Thanks,

 

 

3 REPLIES 3
Reeza
Super User

Ok. Please produce some sample data and expected output. 

 

You say matrix of data, are you planning to be using SAS IML, which is more matrix/array/R like R, or Base SAS programming. 

Neil_C
Calcite | Level 5

Please see the datafile attached.

I have the datafile on SAS. What I am trying to do is to create a crosstab where Sum of Sales would be shown with Country in row and 4 Regions in columns.

 

 

Reeza
Super User

That sounds like a transpose. Look into proc transpose.

 

I generally don't download XLSX files so if you can't post sample data, someone else will help. 

I still would recommend putting the expected output from your sample file, rather than having people guess at what you want. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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