BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RaviSPR
Quartz | Level 8

hi..i want to update specific excel cells from sas using Proc sql..is it possible??

if yes, i need to update range of excel values using proc sql...i dont want to use SAS-DDE..means dont want to open excel file from sas..rather i just  can connect to excel through proc sql...

finally am struggling to how to give range of excel cell in proc sql to so that i can put data in excel from sas..?ls

1 ACCEPTED SOLUTION

Accepted Solutions
bnarang
Calcite | Level 5

You can create library and map this excel file in the library. Further, you can modify once the datasheets are visible as datasets using PROC SQL.

View solution in original post

8 REPLIES 8
bnarang
Calcite | Level 5

You can create library and map this excel file in the library. Further, you can modify once the datasheets are visible as datasets using PROC SQL.

RaviSPR
Quartz | Level 8

Thank-You...

i think we need to use Named range also in the excel files.

Ksharp
Super User

As above said.

Once you assign a libname to the excel file successfully, You can modify cell like a sas dataset.

libname x excel 'D:\x.xls' scantext=no;

proc sql;

update x.'Sheet1$'n

set _col0='xxx'

  where _col2='my condition';

  quit;

Ksharp

RaviSPR
Quartz | Level 8

Thanks a lot...

yes. its correct.

i got a way to write data to specific excel cells.But am getting variable names into the xl file those i dont want.

below is the code.

Here namedrng1 is the Named range in the excel file contains specific cells in a sheet.

Libname xl excel "Path";

Data xl.namedrng1;

set work.emp;

run;

here am getting columns names into xl file..is there any way to remove sas dataset's(work.emp) column names?

I can hide these columns in the excel file...BUT....still....????

Regards,

SPR.

Ksharp
Super User

If your excel file is in english, try to use XLS engine.

proc export data=sashelp.class outfile='c:\want.xls' replace dbms=xls;

putnames=no;run;

Ksharp

RaviSPR
Quartz | Level 8

Sorry Ksharp. if we use proc export we cant write data to required cell ranges in the excel...!! right??

is any further add-ons for my code which i mentioned above.i.e Libname and Proc SQL connect to excel, to eliminate column names while writing data into the cell ranges??

Thanks a lot.

Ksharp
Super User

My SQL 's update statement will not get extra variable name . Did you try it ?

RaviSPR
Quartz | Level 8

But your code writes the data by checking condition with the excel cell values.

Actually, i want to write/export data which is coming from sas datasteps. so, i cant check the conditions with the values presented in the excel.

i.e its entirely new data for the new month which should be written to excel excel cell ranges.

The problem here is unwanted column ranges..But for time being i am hiding those columns in the template file.

Thanks,

SPR.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 8 replies
  • 5582 views
  • 4 likes
  • 3 in conversation