num Y x1 x2 x3 x4
1 11 1 0 0 0
2 17 1 0 0 0
3 16 1 0 0 0
4 14 1 0 0 0
5 15 1 0 0 0
6 12 2 1 0 0
Please note:
I read the above-named dataset (also attached for proper viewing) saved as ak.txt into SAS University edition and SAS did not read the dataset correctly.
This is the code I used:
72
73 data project;
74 infile "/folders/myfolders/ak.txt";
75 input num$ y$ x1$ x2$ x3$ x4$ x5$ x6$;
76 run;
This is the output I obtained:
1 Y x1 x2 x3 x4 1 11 1
2 2 17 1 0 0 0 3 16
3 4 14 1 0 0 0 5 15
Any ideas to solve this problem for SAS to give the right output,please?
This is the log:
NOTE: LOST CARD.
num=6 y=12 x1=2 x2=1 x3=0 x4=0 x5= x6= _ERROR_=1 _N_=4
NOTE: 7 records were read from the infile "/folders/myfolders/ak.txt".
The minimum record length was 22.
The maximum record length was 22.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.PROJECT has 3 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
num Y x1 x2 x3 x4
input num$ y$ x1$ x2$ x3$ x4$ x5$ x6$;
You're showing different number of variables, do you only have 4 or 6? It looks like it doesn't align so that's possibly your issue. The note indicates this as well:
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
@ak2011 wrote:
num Y x1 x2 x3 x4
1 11 1 0 0 0
2 17 1 0 0 0
3 16 1 0 0 0
4 14 1 0 0 0
5 15 1 0 0 0
6 12 2 1 0 0
Please note:
I read the above-named dataset (also attached for proper viewing) saved as ak.txt into SAS University edition and SAS did not read the dataset correctly.This is the code I used:
72
73 data project;
74 infile "/folders/myfolders/ak.txt";
75 input num$ y$ x1$ x2$ x3$ x4$ x5$ x6$;
76 run;
This is the output I obtained:1 Y x1 x2 x3 x4 1 11 1
2 2 17 1 0 0 0 3 16
3 4 14 1 0 0 0 5 15
Any ideas to solve this problem for SAS to give the right output,please?This is the log:
NOTE: LOST CARD.
num=6 y=12 x1=2 x2=1 x3=0 x4=0 x5= x6= _ERROR_=1 _N_=4
NOTE: 7 records were read from the infile "/folders/myfolders/ak.txt".
The minimum record length was 22.
The maximum record length was 22.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.PROJECT has 3 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
use FIRSTOBS=2 in your infile statement
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.