Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:30:15+00:00 2026-06-01T08:30:15+00:00

I have the following code at the end of my code to export the

  • 0

I have the following code at the end of my code to export the SAS data to an Excel File.
The RepDate is set up as follows at the start of the code:

%let RepDate = &SYSDATE9; 

The date works perfectly, however when I use the following code to export the data:

PROC EXPORT DATA=MYData         
OUTFILE="C:\Documents and settings\Documents\myFile &RepDate.XLS"     DBMS=EXCEL2000 REPLACE;
RUN;

The date is entered into the file name okay, but XLS is added to the file name. The dot for the file extension is missing and the file name becomes:

myFile02APR2012XLS

This is not what I expected, I expected the file name to be as follows:
myFile02Apr2012
with the .XLS as the file extension. Is there a way to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:30:16+00:00Added an answer on June 1, 2026 at 8:30 am

    You need

    OUTFILE="C:\Documents and settings\Documents\myFile &RepDate..XLS"
    

    You need to use an extra . after the &RepDate macro variable reference. The first . terminates the macro variable reference, and the second . is then part of the string.

    To understand why the . is necessary, you might want to build a filename

    02Apr2012MyFile.XLS
    

    In this case you would want to try and write:

    &RepDateMyFile.XLS
    

    but the sas interpreter wouldn’t know where the macro variable names ends and the string text continues, so a dot is required in order to end the macro variable reference:

    &RepDate.MyFile.XLS
    

    In your case you want to then put a . immediately after the resolved macro variable, hence the need for two dots.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code ..i need to loop through end of the file
Let's say I have the following ruby code : def use_object(object) puts object.some_method end
I have the following lines of code: if(std::binary_search(face_verts.begin(), face_verts.end(), left_right_vert[0]) && std::binary_search(face_verts.begin(), face_verts.end(), left_right_vert[1]))
I have the following code to export a gridview to excel and the export
I have following code class User attr_accessor :name end u = User.new u.name =
I have the following code in the front end <asp:Content ID=Content1 ContentPlaceHolderID=cphMain runat=server> <script
I have the following code: for attribute in site.device_attributes device.attribute end where I would
I have the following code for creating tabs. It works at the end of
I have this code which export data from GridView to csv. It works with
I have the following code in an Active Record file. class Profile < ActiveRecord::Base

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.