BookmarkSubscribeRSS Feed
kbelang1
Fluorite | Level 6

Hello,

 

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!

 

 

4 REPLIES 4
Astounding
PROC Star

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).

kbelang1
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. 🙂

Astounding
PROC Star

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.

ballardw
Super User

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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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