×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Quotes!

Quotes!

(OP)
Hi,

I've pulled a list of about 3k Excel Documents in a folder on our network drive.

I want to loop through those documents and DDE in some information (there are about 200+ values in the document but will only list 2 of them below)

The problem im having is when there is an & or a ' in the string, it bombs out of the macro.. Ive tried the %Quote, %NRQuote, %NRBQuote, %str etc.. etc.. and still having no luck with it..

Below is a sample of the code i have:

CODE

%macro Import_I_E(Path=, Doc=, Dmod=, Tmod=, Team=);

    data _null_;
    file xlout;
        put '[error(false)]';
        put '[Open("&Path.&Doc.")]';
    run;

    Filename XLin1 DDE "Excel|&Pth.[&Doc2.]I&E inc portfolio section!R11C5";
    Filename XLin2 DDE "Excel|&Pth.[&Doc2.]I&E inc portfolio section!R12C5";

Data InData2;
    * Account Number;
        Infile XLin1 dlm='09'x notab missover dsd;
        Informat Account 10.0;
        input Account;
        Format Account 10.0;
    *Date;
        Infile XLin2 dlm='09'x notab missover dsd;
        Informat Date ddmmyy10.;
        input Date;
        Format Date Date9.;
    *Modify Date;
        Informat Modified_Date date9.;
        Modified_Date = &Dmod.;
        format Modified_Date date9.;
    *Modify Time;
        Informat Modified_Time time8.;
        Modified_Time = &Tmod.;
        format Modified_Time time8.;
    *Team Folder;
        Informat Team $50.;
        Team = "&Team.";
        Format Team $50.;
output;
run;

%mend Import_I_E;

%Import_I_E(Path=\\F\Forms\I&E forms\2011\06 June\,
            Doc=888745 -O'Shane.XLS,
            Dmod=18782,
            Tmod=46380,
            Team=Team 1);

As you can see, there is an & in the Path Variable (so every time i run it tries to compile &E, and a ' in the Doc Variable (and the possibility of an & too)).

Can anyone help me out?

Thanks

Shenn

RE: Quotes!

How about you don't use the quotes in your macro but in the macro-call, like so:

%Import_I_E('Path=\\F\Forms\I&E forms\2011\06 June\',
            Doc="888745 -O'Shane.XLS",
            Dmod=18782,
            Tmod=46380,
            Team=Team 1)

and then leave them out in the macro itself

put '[Open(&Path.&Doc.)]';

greetings






 

BIGuidance
www.biguidance.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close