DATA Step, Macro, Functions and more

datalines

Reply
Frequent Contributor
Posts: 87

datalines

I'm not able to read the below datalines corretly. I want the table to look just like it appears in the datalines (i.e., missing values in field 3 for row 3 and 4).

data x;

infile datalines dlm=' ' dsd;

input  scode field2 field3 field4;

datalines;

2 23 34543 233409

3 24 34569 800380

5 45           098873

8 33           093872

;

run;

Please suggest the currect answer.

New Contributor
Posts: 3

Re: datalines

Hello Friend,

1)

in this table all variable are in numerical so you have to represent a period  (a dot) for  missing value.

data x;

input  score field2  field3 field4;

datalines;

2 23 34543 233409

3 24 34569 800380

5 45      198873

8 33      093872

;

run;

try this also...

if you want to missing value  then you can  use  $ sign...

data x;

input  score field2  field3 $5. field4;

datalines;

2 23 34543 233409

3 24 34569 800380

5 45      198873

8 33      093872

;

run;

Thanks

Valued Guide
Posts: 2,177

Re: datalines

As these datalines are in a fixed layour no need to use DSD or delimiters

Inpit a 1. B 3. C 6. D 6. ;

Ask a Question
Discussion stats
  • 2 replies
  • 167 views
  • 0 likes
  • 3 in conversation