BookmarkSubscribeRSS Feed
Fluorite | Level 6



Do anyone know if first.variable/last.variable can be used to transpose data? For instance, I want to transform a long list of character variables to a single list by a group. Does that make sense and is this possible? Thanks!



Opal | Level 21

No, they can't be used since they are not saved in the data set.  They are temporary variables only.


Choices abound.  The DATA step could copy the first. and last. variables to new variables which could be used later.  Or, PROC TRANSPOSE could use a BY statement (perhaps the same BY statement that appears in the DATA step).

Fluorite | Level 6

Thank you! Your response was extremely helpful. Now I can stop trying to make something work using a method that doesn't support it. 🙂

Opal | Level 21

Just a follow-up note .... it depends on how you plan to transpose.  PROC TRANSPOSE is out.  But there are ways to transpose data using a DATA step.  If that's the route you are taking, you can use the BY variables in the same DATA step.

Super User

It might help to provide some small example data, hopefully as data step code, and what the result should be.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1 like
  • 3 in conversation