## input wiht ampersand (&)

Solved
Super Contributor
Posts: 464

# input wiht ampersand (&)

hi guys

I want SAS to read in the following:

data one;

input name & :\$20.  age;

cards;

Marry lee Jones 40

Arnold Jonson 45

;

but i get errors

What am i doing wrong here?

Accepted Solutions
Solution
‎03-14-2013 06:30 PM
Super User
Posts: 8,114

## Re: input wiht ampersand (&)

& says to keep reading until it sees two or more spaces.  So the 40 on the first line becomes part of the name. It then needs to go to the next line to read the age and cannot translate Arnold into a number. Hence the error message.

Add an extra space in front of the age on each row.

All Replies
Solution
‎03-14-2013 06:30 PM
Super User
Posts: 8,114

## Re: input wiht ampersand (&)

& says to keep reading until it sees two or more spaces.  So the 40 on the first line becomes part of the name. It then needs to go to the next line to read the age and cannot translate Arnold into a number. Hence the error message.

Add an extra space in front of the age on each row.

Super Contributor
Posts: 464

## Re: input wiht ampersand (&)

That was quick and sweet

Thanks Tom

Posts: 1,270

## Re: input wiht ampersand (&)

Hi Tom,

Based on this discussion, I need to learn how can we refer variable names with spaces or dash - or dots (.)  betwen them in arrays?

Thanks,

Naeem

Super User
Posts: 8,114

## Re: input wiht ampersand (&)

Start a new thread and explain in more detail what you want.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
• 4 replies
• 286 views
• 1 like
• 3 in conversation