BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

PROC TRANSPOSE will work.  You might need to run it twice however.

proc transpose data=have out=tall;
  by id event;
  var q1-q24;
run;
proc transpose data=tall out=want(drop=_name_);
  by id;
  id event _name_;
  var col1;
run;

Or you could leave the data as it is and just PRINT it that way using PROC REPORT.

proc report data=have;
   column id event,(q1-q4);
   define id / group;
   define event / across;
run;
bhr-q
Pyrite | Level 9
Thank you for your answer, it was helpful.
Kurt_Bremser
Super User

I'd go one step further and make your initial dataset longer:

proc transpose data=have out=long name=quarter;
by record_id event notsorted;
var q:;
run;

proc report data=long;
column record_id event,quarter,col1;
define record_id / group;
define event / "" across;
define quarter / "" across;
define col1 / "" analysis;
run;
bhr-q
Pyrite | Level 9
Thank you for your answer, it was helpful

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 18 replies
  • 1127 views
  • 8 likes
  • 6 in conversation