LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 23 Jan 2004 05:31:38 -0500
Reply-To:     ben.powell@CLA.CO.UK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         ben.powell@CLA.CO.UK
Subject:      Re: Macro cards to text file / put ?

Thanks Harry, "resolve" was my next problem. Having played around with the code I got this to work:

%macro mac2_load(num=,sec=);

%let repid = &num._&sec;

filename ske "P:\SAS\Scripts\ske.txt"; filename one "P:\SAS\Scripts\&repid._load.vbs"; data _NULL_; length input $75.; infile ske dsd missover; file one; input input $; input = resolve(input); put input; run;

%mend;

Ben.

On Thu, 22 Jan 2004 11:06:47 -0500, Droogendyk, Harry <Harry.Droogendyk@CIBC.COM> wrote:

>Ben: > >Macro and cards don't get along. If you're intent on using cards, search >the archives for 'cards' and 'macro'. Ian posted something less than 6 >months ago in this vein. > >Realizing that you've only posted a sample, and that the VB code might be >more involved and not static like this appears to be, why not create a file >of the skeleton VB code, burying macro variables in the code as required ( >e.g. if dynamic code is desired, perhaps utilizing &num and &sec ). Read >that file in, use resolve() to resolve the macro variables and write out to >the .vbs file. > >%macro mac2_load(num=,sec=); > >%let repid = &num._&sec; > >filename skeleton 'blah blah'; >filename one "P:\SAS\PROJECTS\Scripts\&repid.load.vbs"; > >data _NULL_; > infile skeleton; > file one; > input; > _infile_ = resolve(_infile_); > put _infile_; >run; > >%mend; > >-----Original Message----- >From: ben.powell@CLA.CO.UK [mailto:ben.powell@CLA.CO.UK] >Sent: January 22, 2004 10:55 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Macro cards to text file / put ? > > >Dear SAS-L, > >Careful of egocentricity in today's climate, and slightly miffed not to >make it onto the frequency of posts leaderboard - heh the author only >started posting in May! - is there an alternative way to do the following? > >Forget it .. I I I I have written some lines to a text file using a fileref >and cards and this works fine. However when I try to wrap this in a macro >the following error is produced: > >ERROR: The macro MAC2_LOAD generated CARDS (data lines) for the DATA step, >which could cause incorrect results. The DATA step and the macro will stop >executing. > >Is there another way (put?) to print these lines that the macro will >execute? > >TIA > ><sample> >%macro mac2_load(num=,sec=); > >%let repid = &num._&sec; > >data batch; >length l $75.; >infile datalines dsd missover; >input l $; >cards; >dim shell > >set shell=CreateObject("WScript.Shell") > >do while(shell.AppActivate("Oracle")=FALSE) > wscript.sleep 200 >loop > >shell.sendkeys "USER/PASS" >shell.sendkeys "{ENTER}" >shell.sendkeys "s" >...etc... >shell.sendkeys "%{F4}" > >wscript.sleep 200 >run; > >filename one "P:\SAS\PROJECTS\Scripts\&repid.load.vbs"; >data _NULL_; >file one; >set batch; >put l; >run; > >%mend; ></sample>


Back to: Top of message | Previous page | Main SAS-L page