BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi -- has anyone exported to Excel using a dynamic, variable filename? I have a global variable with value assigned by a "%let" statement that I want to set to the Excel file name that I'm exporting to. I've seen DDE documentation and a macro called %exporttoXL, but I'm not sure that extent is needed or whether either approach will suit my simple need here. THanks for any tips!
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Please explain more about what determines the "dynamic, variable filename"? Also, have you considered PROC EXPORT and using the macro variable approach to resolve the PC file name in a prior DATA step or PROC SQL (again, your advance SAS processing component has not been stated/identified at this point).

Scott Barry
SBBWorks, Inc.

PROC EXPORT Statement
http://support.sas.com/documentation/cdl/en/acpcref/61891/HTML/default/a003102702.htm
deleted_user
Not applicable
Hi -- I'm on v 9. Your suggestion about using a macro is something I had tried, except I was using a constant string value concatenated with a macro variable for the file name. Instead, I will try putting everything including the constant string in the macro variable rather than trying to do the concatenation. Thanks
Cynthia_sas
SAS Super FREQ
Hi:
You can concatenate a constant string with macro variables. Consider the LOG view of some %LET statements and the resulting %PUT output. You just have to remember the rules of how to concatenate and reference macro variables.

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001071889.htm
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001071915.htm
http://www.nesug.org/proceedings/nesug03/bt/bt009.pdf
http://www2.sas.com/proceedings/sugi28/056-28.pdf


cynthia
[pre]
SAS LOG:
453 %let path= c:\temp;
454 %let name= fred;
455 %let ext = xls;
456
457 %let pathfile=&path\&name;
458 %let pne = &path\&name..&ext;
459 %let othr = &path\fixed\part\&name..&ext;
460
461 %put path is: &path;
path is: c:\temp
462
463 %put name is: &name;
name is: fred
464
465 %put ext is: &ext;
ext is: xls
466
467 %put pathfile is: &pathfile;
pathfile is: c:\temp\fred
468
469 %put pne is: &pne;
pne is: c:\temp\fred.xls
470
471 %put othr is: &othr;
othr is: c:\temp\fixed\part\fred.xls

[/pre]

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!

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
  • 4421 views
  • 0 likes
  • 3 in conversation