Help using Base SAS procedures

Update Tables

Reply
Regular Contributor
Posts: 229

Update Tables

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;
Frequent Contributor
Posts: 127

Re: Update Tables

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
SAS Employee
Posts: 105

Re: Update Tables

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;
Ask a Question
Discussion stats
  • 2 replies
  • 109 views
  • 0 likes
  • 3 in conversation