BookmarkSubscribeRSS Feed
SaiSwaroop
Calcite | Level 5

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 .

 

3 REPLIES 3
kannand
Lapis Lazuli | Level 10
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
Reeza
Super User

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.

 

pic_sas
SAS Employee

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.

 

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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