Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

How to reverse a table in SAS?

Reply
N/A
Posts: 1

How to reverse a table in SAS?

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!

PROC Star
Posts: 7,473

How to reverse a table in SAS?

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.

Ask a Question
Discussion stats
  • 1 reply
  • 184 views
  • 0 likes
  • 2 in conversation