How to add a new record at the top of dataset

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

How to add a new record at the top of dataset


Hi all,

I have two datasets,

DatasetA

----------------

Name$ age place$

F     24     NJ

D     85     NY

B      34     AC

DatasetB

----------------

Name$ age place$

C     45     BM

F     54     NY

I want to add the first OBS to from datasetB(C     45     BM)  to datasetA 

the datasetA should the records as

DatasetA

----------------

Name$ age place$

C     45     BM

F     24     NJ

D     85     NY

B      34     AC

thank you in advance


Accepted Solutions
Solution
‎04-17-2013 03:56 AM
Contributor
Posts: 22

Re: How to add a new record at the top of dataset

data datasetA;

set datasetB(firstobs=1 obs=1) datasetA;

run;

Hey got it

thank u


View solution in original post


All Replies
Super Contributor
Posts: 644

Re: How to add a new record at the top of dataset

This looks like a homework question to me.  Explore the set statement and the obs= option.

Richard

Super User
Posts: 5,254

Re: How to add a new record at the top of dataset

What is the requirement?

Data never sleeps
Solution
‎04-17-2013 03:56 AM
Contributor
Posts: 22

Re: How to add a new record at the top of dataset

data datasetA;

set datasetB(firstobs=1 obs=1) datasetA;

run;

Hey got it

thank u


Super Contributor
Posts: 644

Re: How to add a new record at the top of dataset

Good.  Firstobs is redundant (not needed here) because firstobs=1 by default.

Richard

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 195 views
  • 0 likes
  • 3 in conversation