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 (May 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 24 May 2002 10:11:40 -0400
Reply-To:     Howard_Schreier@ITA.DOC.GOV
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard_Schreier@ITA.DOC.GOV
Subject:      Re: Use of a string in INFILE

Why not?

Just wrap the value in double quotes, since it is a character constant at execution time:

Session = "&semr.&year.";

By the way, you could leave out the periods:

Session = "&semr&year";

They are only needed to eliminate ambiguity. For example, if you wanted to embed an underscore between the two strings, you would have to code:

Session = "&semr._&year";

Otherwise SAS would look for a macrovariable &SEMR_ and you would get an error.

On Thu, 23 May 2002 19:33:39 GMT, Elise Beauregard <elise.beauregard@MCGILL.CA> wrote:

>Just one other question. >I would like to keep the info of the macro variable in my SAS Dataset. >Actually, I now have two macro var and would like to concatenate the two of >them. Is that doable? >for example, I would like a variable to be called : Session = &semr.&year. >thanks, >Elise >___________________________________________________________________________ _ >__________________ > >%LET SEMR=F; >%let YEAR=2001; > >/*------------------------------S T U D E N T S E C T I O >N-----------------------------*/ > >libname recu 'G:\UPO\SHARE\Data Warehouse\RECU\sasdata\RECU\'; >filename student "G:\upo\share\data >warehouse\recu\student_fin&YEAR.&SEMR..txt"; >filename program "G:\upo\share\data >warehouse\recu\program_fin&YEAR.&SEMR..txt"; >filename activity "G:\upo\share\data >warehouse\recu\course_fin&YEAR.&SEMR..txt"; >RUN; > >DATA RECU.STUDENT; > INFILE student LRECL=2300 MISSOVER; > INPUT > @7 TERM $2. > @9 STUDID $20. >___________________________________________________________________________ _ >_______________________ > >"Prasad Ravi" <prasad.s.ravi@HOUSEHOLD.COM> wrote in message > >> Sure why not?, except, use double quotes around your file path in the >> INFILE statement for the macro var to resolve and add another '.' end of >> the macro var. >> >> DATA RECU.STUDENT; >> INFILE "G:\recu\student_fin&SEMR..txt" LRECL=2300 MISSOVER; >> >> >> Prasad Ravi >> >> >> >> >> >> >> Elise To: >SAS-L@LISTSERV.UGA.EDU >> <elise.beauregard cc: >> @MCGILL.CA> Subject: Use of a string >in INFILE >> Sent by: "SAS(r) >> Discussion" >> <SAS-L@LISTSERV.U >> GA.EDU> >> >> >> 05/23/2002 08:36 >> AM >> Please respond to >> Elise >> >> >> >> >> >> Is it possible to put a string in the name of the file of the INFILE? >> I know this doesn't work. >> Thanks for any help. >> >> %LET SEMR= A00; /* CHANGE RECU SEMESTER*/ >> >> libname recu 'G:\sasdata\RECU\'; >> DATA RECU.STUDENT; >> INFILE 'G:\recu\student_fin&SEMR.txt' LRECL=2300 MISSOVER;

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