SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to add observations to a dataset

Reply
New Contributor
Posts: 3

How to add observations to a dataset

Hi friends,

 

For suppose i have a program :

 

data demo;

set oracle_data;

run;

 

Let us say oracle_data dataset have 100 observaions , so our demo should also have 100 observations if i want to add 10 more observations to demo dataset which are not present in oracle_data.

How do i do this?

Can i use datalines statement here? To append new observations?

 

Thanks  in advance .

 

Regular Contributor
Posts: 161

Re: How to add observations to a dataset

[ Edited ]
Posted in reply to SaiSwaroop
data subset10;
set oracle_data(obs=10);
run;
data demo;
set oracle_data subset10;
run;
 

One way you can add is by adding another dataset which is a subset of what you have and limit to 10 

Kannan Deivasigamani
Super User
Posts: 19,791

Re: How to add observations to a dataset

Posted in reply to SaiSwaroop

It depends on where your observations are coming from.

 

One way is to create a new dataset with the observations, using either cards and then append the datasets. 

You can use either proc append, a data step or a union all step in proc sql, as a few options.

 

SAS Employee
Posts: 4

Re: How to add observations to a dataset

Posted in reply to SaiSwaroop

Hi,

Simply store those additional observations (10 from your example) in a separate dataset and user Proc Append after the data step that you have.

 

Ask a Question
Discussion stats
  • 3 replies
  • 427 views
  • 0 likes
  • 4 in conversation