BookmarkSubscribeRSS Feed
pearsoninst
Pyrite | Level 9

data newdata;
Input

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

Proc Print data = newdata;
run;

2 REPLIES 2
kannand
Lapis Lazuli | Level 10

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
ballardw
Super User

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 825 views
  • 0 likes
  • 3 in conversation