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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 505 views
  • 0 likes
  • 3 in conversation