BookmarkSubscribeRSS Feed
vomer
Obsidian | Level 7

Hi Guys,

I am wondering if this is possible?

Basically if I have 2 excel files : File1.xls and File2.xls

Can I use SAS to say: Take all rows/columns from file1.xls and put them (starting at a specific cell) in File2.xls?

The next part of my question is...can I do the same for specific cell ranges? So Cells A1:A10 from File1.xls to Cells N1:N10 in File2.xls

Please provide sample codes if possible Smiley Happy

Thanks!

3 REPLIES 3
art297
Opal | Level 21

Does your site have SAS Access/PC files?

vomer
Obsidian | Level 7

Yes they do.

art297
Opal | Level 21

Not sure why I asked about SAS Access, as the export procedure doesn't allow one to use a range statement.

Thus, I used DDE to export the file.  If you're not familiar with DDE, you can find numerous examples on the web.

I took a shortcut and simply opened the desired output file manually.  You would probably want to do all of that programmatically .. which is definitely possible.

Below, I use proc import to import the desired range, then output it to a different range on another spreadsheet:

PROC IMPORT OUT= WORK.have;

DATAFILE= "C:\art\abc.xls"

DBMS=excel REPLACE;

range='feb2012$A1:A27'n;

GETNAMES=no;

Run;

filename dataout dde "excel|[cba.xls]Sheet1!r1c14:r27c14" notab;

data _null_;

set have;

file dataout;

put f1 $20.;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 646 views
  • 0 likes
  • 2 in conversation