0
votes

I hava a table in sas with columns names 'Parameter' and 'Parameter_value'.

            Parameter                 Parameter_value


1           Member-ID                10

2           User ID                  90

3           Accounting Year          2000

4           Quarter                  0

5           As of Quarter End Date   12-12-2000

6           Status (File Type)       s

I want to convert the data of column 'Parameter' into columns Names and the data of 'Parameter_value' into the row. Like:

Member-ID      User ID      Accounting Year   Quarter    As of Quarter End Date       Status (File Type)

10              90            2000              0          12-12-2000                   s

how do I achieve this? I wrote a proc for this but it does't show the required output. proc is:

PROC SQL;
    CREATE VIEW WORK.SORTTempTableSorted AS
        SELECT T.Parameter, T.Parameter_Value
    FROM CSV.S_SUMMARY as T
;
QUIT;
PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
    OUT=WORK.TRNSTransposedS_SUMMARY(LABEL="Transposed CSV.S_SUMMARY")
    PREFIX=Column
    NAME=Source
    LABEL=Label
;
    VAR Parameter Parameter_Value;

/* -------------------------------------------------------------------
   End of task code.
   ------------------------------------------------------------------- */
RUN; QUIT;

Thanks in advance

1

1 Answers

0
votes

You must use the ID option of the PROC TRANSPOSE:

PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
  OUT=WORK.TRNSTransposedS_SUMMARY(LABEL="Transposed CSV.S_SUMMARY");

  ID Parameter 
  VAR Parameter_Value;
RUN;