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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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