BookmarkSubscribeRSS Feed
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

I have Table1 attached file in detail. I want using Proc Transpose function, have new table called Table2.

 

---------------------------------------------------------------------------------------------------------------------------------

Table1: Month,           ENROLLMENT,    MAJOR_MEDICAL,    PBM,    Pharmacy,   LB,      DENTAL

            _ 2018-01_       212,400              10,962                        2,890     12,344        483      1,868

---------------------------------------------------------------------------------------------------------------------------------

 

I want this transpose become table 2 as :

---------------------------------------------------------------

Table2:  OHI_Plan,                       _2018-01_

            ENROLLMENT                 212,400 

            MAJOR_MEDICAL           10,962 

            PBM                                   2,890 

            Pharmacy                          12,344 

            LB                                      483

            DENTAL                            1,868

--------------------------------------------------------------------------------

SAS code:

Proc sort data = table1;

 By Month;

Run;

 

Proc Transpose data = table1 out=table2;

  name = OHI_PLan;

  ID Month;

run;

 

After the SAS ode run, got result table 2 only has column names, without data.

OHI_Plan , _201801_

 

 

Do not know why.

 

 

9 REPLIES 9
Reeza
Super User

Post your code AND log. 

Does your log have errors?

 


@JHE wrote:

I have Table1 attached file in detail. I want using Proc Transpose function, have new table called Table2.

 

---------------------------------------------------------------------------------------------------------------------------------

Table1: Month,           ENROLLMENT,    MAJOR_MEDICAL,    PBM,    Pharmacy,   LB,      DENTAL

            _ 2018-01_       212,400              10,962                        2,890     12,344        483      1,868

---------------------------------------------------------------------------------------------------------------------------------

 

I want this transpose become table 2 as :

---------------------------------------------------------------

Table2:  OHI_Plan,                       _2018-01_

            ENROLLMENT                 212,400 

            MAJOR_MEDICAL           10,962 

            PBM                                   2,890 

            Pharmacy                          12,344 

            LB                                      483

            DENTAL                            1,868

--------------------------------------------------------------------------------

SAS code:

Proc sort data = table1;

 By Month;

Run;

 

Proc Transpose data = table1 out=table2;

  name = OHI_PLan;

  ID Month;

run;

 

After the SAS ode run, got result table 2 only has column names, without data.

OHI_Plan , _201801_

 

 

Do not know why.

 

 


 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

Thank you for rely to me. There is no error.

 

Log file attached .

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

this is the log

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

disregards the previous log file.

Reeza
Super User

1. This log doesn't match the code you posted in your first post

2. The log doesn't have errors but there are some notes that tell you what's wrong. 

3. I don't know which log/code you're using and what to say beyond this because its not clear what you're doing. 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

transpose Table1 to tabl2 2 format.

 

log attached,  and table detail atatched

 

SAS code:

 

proc sort data=WORK.Table1 ;

by month;

run;

proc transpose data=WORK.Table1 out=WORK.Table2 name=OHI_Plan;

id month;

run;

 

run the SAS code, having result as Tbale2, only have two columns without data.

 

 

 

Reeza
Super User

Note: No variables to transpose

 

Maybe you missed the note above.

Try adding your variables to the VAR statement.

 

 

 

 

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

Thank you, this is worked. Smiley Happy

 

proc transpose data=WORK.Table1 out=WORK.Table2 (drop= _name_) label=OHI_Plan ;

id month;

var enrollment major_medical pbm Pharmacy lb dental;

run;

art297
Opal | Level 21

Interesting! I'd have thought, from your example, that you wanted:

proc transpose data=WORK.Table1 out=WORK.Table2 ;
  var Month ENROLLMENT MAJOR_MEDICAL PBM Pharmacy LB DENTAL;
run;

Art, CEO, AnalystFinder.com

 

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
  • 9 replies
  • 1474 views
  • 0 likes
  • 3 in conversation