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

attached is the dataset,

 

DATA data;
INFILE "......\data.txt";

INPUT  A 11.  B          ;

RUN;

but the result is weird. some values are right, but some of them are false. 

QQ截图20151108030305.png

 

 

The log shows:

 

14 CHAR 10.20.00000001 14
ZONE 33033233333333
NUMR 10920E00000001
A=. B=1 _ERROR_=1 _N_=13
NOTE: 16 records were read from the infile "\\client\E$\course
materials\continue\Homeworks\HW2\data.txt".
The minimum record length was 4.
The maximum record length was 24.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.DATA has 14 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.26 seconds
cpu time 0.03 seconds

 

What is the matter of my code? and What does the former lines(in red) mean in the log?

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

The values in your file are separated by tab characters and start on line 2. So you must read them with:

 

data data;
infile "......\Data.txt" dlm='09'x firstobs=2;
input a b;
run;
PG

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

The values in your file are separated by tab characters and start on line 2. So you must read them with:

 

data data;
infile "......\Data.txt" dlm='09'x firstobs=2;
input a b;
run;
PG
pearsoninst
Pyrite | Level 9
Hi can you explain '09'x this ?
PGStats
Opal | Level 21

'09'x is the hexadecimal representation of a tabulation character.

PG
DingDing
Quartz | Level 8

Thanks MR. PGstats, it works!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1089 views
  • 2 likes
  • 3 in conversation