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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1364 views
  • 0 likes
  • 3 in conversation