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

Hi All,

Sometimes when I hold the value of a variabe in SAS, I am unsure where to use the trailing @ as I get an error when reading other variables. I use this as an example:

Suppose I want to read this text tab delimited file:

Andrew Rapayer 45 61

Abbey Murrey 10 9

Tina Amber 10 20

I should hold the value of Andrew Rapayer and then read off the next two values using @. The code I use:

Data test;

infile "C:\SAS\test.txt" dlm = ' ';

input Name & : $15. @

        Age : 2.

        Height : 2.

;

run;

Since I am using dlm ='' option so each value is seperated by a space so when I read first obs from text file it would treat Andrew & Rapayer as seperate values but I want to input that as Name so I am using & to read this and then hold the value using @ but I get an error when reading the Age:

ERROR 22-232 : Expecting a Name.

Kindly advise what is the missing link.

Kind Regards

SK

1 ACCEPTED SOLUTION

Accepted Solutions
Scott_Mitchell
Quartz | Level 8

From what I understand, using the ampersand special character/modifier won't help you anyway.  When using this modifier SAS treats two or more spaces as the end of the string, which you don't have in your sample data.

View solution in original post

1 REPLY 1
Scott_Mitchell
Quartz | Level 8

From what I understand, using the ampersand special character/modifier won't help you anyway.  When using this modifier SAS treats two or more spaces as the end of the string, which you don't have in your sample data.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 793 views
  • 1 like
  • 2 in conversation