BookmarkSubscribeRSS Feed
Jcox22
Calcite | Level 5

I'm a new SAS programmer and am currently working on a dataset thats disorganized like this:

 

data1 var1 data2 var2 data3 var3

data1 var1 data1 var1 data2 var2 ...

 

I was wondering if there was a pointer in sas (like @)  that would allow me to point before the variable to organize the data. Thanks

 

 

EDIT: Resolved

2 REPLIES 2
Astounding
PROC Star

Not sure if this is what you are after, but the INPUT statement supports moving to a character string within the line such as:

 

input @'data1' +5 var1;
Kurt_Bremser
Super User

In your second row, you have two values for "var1". How do you want to handle such an occurrence? First value, last value, or do you want to output a separate observation for each value? In the latter case, what do you want to do with the other name/value pairs in the same input line?

It would be helpful if you posted the expected dataset from your input data.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 748 views
  • 0 likes
  • 3 in conversation