BookmarkSubscribeRSS Feed
helloSAS
Obsidian | Level 7

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.

2 REPLIES 2
dipun
Calcite | Level 5

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

Peter_C
Rhodochrosite | Level 12

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

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

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