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-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1319 views
  • 6 likes
  • 6 in conversation