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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 4 replies
  • 753 views
  • 1 like
  • 3 in conversation