DATA Step, Macro, Functions and more

how to read Blank(no dot just white space) values

Reply
Frequent Contributor
Posts: 108

how to read Blank(no dot just white space) values

data newdata;
Input

@1A
@3B
@5C
@7D;
datalines;
1 2 3 4
1    2 2
2    2 2
;
run;

Proc Print data = newdata;
run;

Regular Contributor
Posts: 161

Re: how to read Blank(no dot just white space) values

Posted in reply to pearsoninst

Please see the input var definitions below:

 

data newdata;
Input
@1 A $1.
@3 B $1. 
@5 C $1.
@7 D $1.;
datalines;
1 2 3 4
1   2 2
2   2 2
;
run;
Proc Print data = newdata;
run;

Here is the output for your reference...

 

Obs	A	B	C	D
1	1	2	3	4
2	1	 	2	2
3	2	 	2	2

Hope this helps. Good Luck...!!!

Kannan Deivasigamani
Super User
Posts: 11,343

Re: how to read Blank(no dot just white space) values

Posted in reply to pearsoninst

These both work

data newdata;
   infile datalines missover;
   Input
      A  1-2
      B  3-4
      C  5-6
      D  7-8
   ;
datalines;
1 2 3 4
1   2 2
2   2 2
;
run;

data newdata;
   infile datalines missover;
   Input
      A  f2.
      B  f2.
      C  f2.
      D  f2.
   ;
datalines;
1 2 3 4
1   2 2
2   2 2
;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 183 views
  • 0 likes
  • 3 in conversation