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. 

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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