Help using Base SAS procedures

Cross tab in SAS

Reply
N/A
Posts: 1

Cross tab in SAS

I have account number and the ratings for the previous months and the current month like below

Account Number  Aug Rating                Account Number          Sept Rating

100                             A                       100                                   A

200                             D                        123                                  F     

300                             C                        400                                  B

400                             A                         500                                 C

500                             D                         300                                 C

--                                -

--                                -   

I need the ouput in sas in such way that i need to know whether the how the ratings are moving compared to that previous month. I was able to get in this kind of excel , but need to write in SAS.

Any help is highly appreciated.

                                  Sept Rating

Aug Rating                      A               B              C   D  E F

A                                   1                1

B

C                                                                     1

D                                                                     1

E

Thanks

Raj

PROC Star
Posts: 7,364

Cross tab in SAS

From your description, the account numbers appear to be irrelevant.  If so, I think creating a format and using proc tabulate will provide the output that you want.  E.g.:

proc format;

  value $rating

'A'='A'

'B'='B'

'C'='C'

'D'='D'

'F'='F'

;

run;

data have;

  format Aug_Rating Sept_Rating $rating.;

  input Account_Number (Aug_Rating Sept_Rating) ($);

  cards;

100  A  A

200  D  F   

300  C  B

400  A  C

500  D  C

;

proc tabulate data=have ;

  class Aug_Rating Sept_Rating /preloadfmt;

  table Aug_Rating,Sept_Rating /printmiss ;

run;

Super User
Posts: 9,691

Cross tab in SAS

your output and data is ambiguous.

1 is not in their right palce for output.

Ksharp

Ask a Question
Discussion stats
  • 2 replies
  • 128 views
  • 0 likes
  • 3 in conversation