BookmarkSubscribeRSS Feed
Ody
Quartz | Level 8 Ody
Quartz | Level 8

Hi all,

 

I've been trying to solve this problem on and off for a number of days without much luck. Appreciate any thoughts on it.

 

I create this variable:


%let today = today(); 
data _null_;
call symput ('Stamp',"Report created: "||put(today(),mmddyy10.));
run; 
%put &Stamp;

It gives me the following: Report created: mm/dd/yyyy

 

All I want to do is take this variable and export it to a specific cell in excel. Seems easy, maybe it is, but I haven't been able to figure out how to do it without creating a table in SAS first. 

 

I can't use DDE because the code will ultimately run from a server that does not have excel installed. I can do it locally but ultimately that's not gonna work.

 

Code for the curious:

options noxwait noxsync xmin;
%sysexec "&Directory\&tprogram..xlsb";

data _null_;
rc = sleep(15);
run;


filename Workbook DDE 'Excel|Sheet1!R1C1';
data _null_;
file Workbook;
Stamp = "&Stamp";
put Stamp;
run;

 

I've resorted to creating a table and appending it.:

data Stamp; 
Time_Stamp = "&Stamp"; 
run;

Libname WrkBk EXCEL "&directory\&program..xlsb" Scan_Text = No;

PROC DATASETS 
LIB = WrkBk;
DELETE Stamp;
RUN;
QUIT;

PROC APPEND 
BASE = WrkBk.Stamp
DATA = Stamp;
RUN;

Libname WrkBk CLEAR;

Is there a way to just export the variable without having to go through the process of creating a table for it while also not using DDE? Maybe ODS? Appreciate any thoughts.

1 REPLY 1
Reeza
Super User

Not if you want it in a specific cell. 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 966 views
  • 0 likes
  • 2 in conversation