Help using Base SAS procedures

How proc export to a particular row and column in Excel?

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

How proc export to a particular row and column in Excel?

I was wondering if there is a way to use proc export to place data in a particular row and column in Excel. I know that proc import can access a row and column, but I have not found anything for proc export.


Accepted Solutions
Solution
‎07-13-2015 11:12 AM
Super User
Posts: 19,770

Re: How proc export to a particular row and column in Excel?


All Replies
Super User
Super User
Posts: 7,942

Re: How proc export to a particular row and column in Excel?

First recommendation, don't use proc import/export - they are guessing procedures.

Second point, what exactly is in the spreadsheet your trying to change, Excel is not a good tool for anything, but especially data.   With SAS you *could* use DDE (which is very old tech and not recommended), you could libname excel to the file, and set cell values there.  However if I really had to do this (and I would really not be happy with using Excel for anything other than management toy), I would export the values to be updated into a CSV file from SAS.  Then in the spreadsheet I wanted to change I would write some VBA code to open the CSV, and copy the data items to specific cells.  VBA is very simple and there are plenty of examples online for doing this.

Contributor
Posts: 24

Re: How proc export to a particular row and column in Excel?

Simply, I wanted to places tables next to each other. Nothing major. But, if this is complex, I have something else lined up. I just wondered if it was possible.

Thanks,

Super User
Super User
Posts: 7,942

Re: How proc export to a particular row and column in Excel?

Ah, well that's different.  Use tagsets.Excelxp:

ods tagsets.excelxp file="xyz.xml" options=(sheet_interval="none" sheet_name="mydata");

proc report data=xyx...;

proc report data=zyz...;

ods tagsets.excelxp close;

Contributor
Posts: 24

Re: How proc export to a particular row and column in Excel?

The tables are stacked. Below is the concept that I am looking at. I guess I will have to rely on VB. I was hoping that it would be possible in SAS.

Capture.JPG

Solution
‎07-13-2015 11:12 AM
Super User
Posts: 19,770

Re: How proc export to a particular row and column in Excel?

Contributor
Posts: 24

Re: How proc export to a particular row and column in Excel?

Thank you!!

Super User
Posts: 10,020

Re: How proc export to a particular row and column in Excel?

Libname + excel and change the cell via data step, just like it is a sas dataset ?

Super User
Posts: 19,770

Re: How proc export to a particular row and column in Excel?

There isn't an easy way, but there are other ways to get your data to excel and have it look presentable.

If you absolutely need to link to specific cells, VB is a good way to go. 

ODS TAGSETS and EXCEL are two options.

Base SAS: Demo: ExcelXP Tagset and Microsoft Excel

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 989 views
  • 1 like
  • 4 in conversation