BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Syntas_error
Quartz | Level 8

While taking a SAS practice exam I came across the following line:

 

input @1 Var1 $ @8 Var2 $ ''

 

What does the @ sign mean in this case? This wasn't in the literature.....

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

In your case, it means

 

Read at(@) column 1 the value of var1 upto a default length of 8 bytes of character

 

 

Read at(@) column 8 the value of var2 upto a default length of 8 bytes of character

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

In your case, it means

 

Read at(@) column 1 the value of var1 upto a default length of 8 bytes of character

 

 

Read at(@) column 8 the value of var2 upto a default length of 8 bytes of character

Syntas_error
Quartz | Level 8

And how would SAS interpret this if there were only say four columns?

Reeza
Super User
It depends on other settings as well, specifically the delimiter and informats.
novinosrin
Tourmaline | Level 20

 

Compiler creates a descriptor portion(metadata) with var names and physical memory address to hold values) known as PDV to hold an observation. As input executes taking the default length, var1 gets the value upto whatever there is for the 4 bytes as each column is 1 byte of char. The value of var2 would be missing.

 

Howeever, there is a caveat, the automatic flowover behavior can cause SAS to read the next record and read value for var2, which will cause unexpected results. This is overridden with a truncover option in the infile statement. I would deem this slightly out of scope for this thread imho.

 

 

 


@Syntas_error wrote:

And how would SAS interpret this if there were only say four columns?


 

Reeza
Super User
@ has dual uses within the INPUT statement. It can either indicate the starting column, or if it's trailing, it indicates to hold the line until released.
There's a traailing @ and double trailing @@.

The INPUT statement documentation covers most of it : https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n0oaql83drile0n141pdacojq97s.htm&doc...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 2512 views
  • 10 likes
  • 3 in conversation