BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
I have a Table it has some variables and observations ,now i have some observations in excel now i want to remove the observations in the previous table and insert the observations in the excel to that table

Table

data x;
input id sal;
cards;
1 2
3 4
run;

data in excel;
4 5
6 7

Fianl output i want is

data x;
input id sal;
cards;
4 5
6 7
run;
2 REPLIES 2
Florent
Quartz | Level 8
Hello Michel,

First of all, import the data you have in excel by doing so:

PROC IMPORT OUT= y
DATAFILE= "full path of the excel file.xls"
DBMS=EXCEL2000 REPLACE;
GETNAMES=YES;
RUN;

First row of your excel file should contain the name of your variables.
Then you can replace previous observations from your previous dataset.

DATA x;
SET Y;
RUN;

Regards,
Florent
yonib
SAS Employee
HI michel,
Im not sure l unnderstand exactly, but my solution to your problem is this:


1)Import your excel data to sas , for the example i will call her b
2)than use the proc append procedure ,it looks like this:
To the main table i will call a

proc append base=a
data=b;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1274 views
  • 0 likes
  • 3 in conversation