Help using Base SAS procedures

How to change dataset like this

Reply
Contributor
Posts: 35

How to change dataset like this

how to get need from have(move variable y upward two cells)  in one data step.

Thanks!

data have;

input x y;

cards;

1

2

3 a

4 b

5 c

;

run;

need:

x y

1 a

2 b

3 c

4

5

Super Contributor
Posts: 1,636

Re: How to change dataset like this

Hi George,

Try this:

data have;

infile cards missover;

input x y $;

cards;

1

2

3 a

4 b

5 c

;

run;

data need;

merge have(keep=x) have(firstobs=3 keep=y);

run;

proc print;run;

Linlin

Ask a Question
Discussion stats
  • 1 reply
  • 107 views
  • 3 likes
  • 2 in conversation