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

Hello, All

Suppose I input just one variable Var:

Data Test;

Informat Var $10.;

input Var;

Cards;

abcdefg

ab cdefg

;

I got the following result:

abcdefg

ab

It seems to me that the informat does not work for records 2 in which only the first two characters were recognized because the third character is a blank.

How to let SAS know that the blank character is also part of the data?

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You can also use a helpful informat $varying.Such as:

data temp;

infile datalines length=len;

input var $varying200. len;

datalines;

............

Ksharp

View solution in original post

7 REPLIES 7
OS2Rules
Obsidian | Level 7

Hi:

You can use:

input @001 var $char10.;

as long as the data lines start in cc01.

littlestone
Fluorite | Level 6

Thank you all for helping me.

By the way: what is the difference between input @1 and input @001 ?

Tom
Super User Tom
Super User

No difference.  They might have used the extra zeros to just make the code look more consistent.

INPUT

  @001 var1 $120.

  @121 var2 5.

...

;

data_null__
Jade | Level 19

You can also add & after VAR in INPUT statement.  INPUT VAR &;

You should read about LIST, FORMATTED, COLUMN and NAMED input to understand the nuances of the INPUT statement and the interaction of INFORMAT INPUT and INFILE etc.

Ksharp
Super User

You can also use a helpful informat $varying.Such as:

data temp;

infile datalines length=len;

input var $varying200. len;

datalines;

............

Ksharp

littlestone
Fluorite | Level 6

I apologize for repling late.

Thank you all for great help.

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!

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
  • 7 replies
  • 1976 views
  • 6 likes
  • 6 in conversation