Help using Base SAS procedures

first.variable help

Reply
New Contributor
Posts: 3

first.variable help

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!

 

 

Super User
Posts: 6,785

Re: first.variable help

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

New Contributor
Posts: 3

Re: first.variable help

Posted in reply to Astounding

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

Super User
Posts: 6,785

Re: first.variable help

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
Posts: 13,583

Re: first.variable help

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

Ask a Question
Discussion stats
  • 4 replies
  • 134 views
  • 1 like
  • 3 in conversation