BookmarkSubscribeRSS Feed
dparnes
Calcite | Level 5

Hi,

I need to reverse a table in SAS.

For example I have a list of stores (1, ,2, 3, ..., 2000) on the first column and for each store I have a list of customers (1, ,2, 3, ..., 2000) in the following columns, but this list is limited to up to 12 customers (random number of customers per store).

Now I need to reverse the story, i.e. to build a list of costumers sorted from 1 to 2000 on the first column, and for each customer to find from the original table a list of corresponding stores.

How can I do that in SAS?

Thank you!

1 REPLY 1
art297
Opal | Level 21

Not sure I understand what you have.  Does the following approximate what your file looks like for the first two stores?:

Store Cust1 Cust2 Cust3 Cust4 Cust5 Cust6 Cust7 Cust8 Cust9 Cust10 Cust11 Cust12

1        24     2        5        6        1000  50      80      900     901    902      903     700

2        54     22      58      76       25     90      70      800     801    802      803     600

and you want to end up with a file that looks like?:

Cust Store

24    1

2     1

5      1

6      1

etc.

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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 789 views
  • 0 likes
  • 2 in conversation