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.....
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
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
And how would SAS interpret this if there were only say four columns?
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?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.