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 (September 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 25 Sep 2005 18:59:11 +0000
Reply-To:   iw1junk@COMCAST.NET
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ian Whitlock <iw1junk@COMCAST.NET>
Subject:   Re: Bug in Proc Import and Export?
Comments:   cc: toby dunn <tobydunn@HOTMAIL.COM>, Arthur Tabachneck <art297@NETSCAPE.NET>


As Toby notes '01'x and '02'x are values that macro quoting puts around certain symbols. The simple way to avoid them is to use single quotes to hide the & from the macro facility in the first place.

169 data _null_; 170 '_&_'n = 123; 171 myvarname = vname('_&_'n); 172 put _all_ +1 myvarname=hex10.; 173 run;

_&_=123 myvarname=_&_ _ERROR_=0 _N_=1 myvarname=5F265F2020

The same solution should apply to Arthur's problem, but I cannot prove it since I do not have SAS/ACCESS.

Ian Whitlock ================ Date: Sun, 25 Sep 2005 16:10:54 +0000 Reply-To: toby dunn <tobydunn@HOTMAIL.COM> Sender: "SAS(r) Discussion" From: toby dunn <tobydunn@HOTMAIL.COM> Subject: Re: Bug in Proc Import and Export? Comments: To: art297@NETSCAPE.NET In-Reply-To: <> Content-Type: text/plain; format=flowed Art and Howard, The extra boxes are definitly the macro quotes and if you use %nrstr as the docs suggest to qoute the amper you dont get the warning like with %str given when theings resolve and what will stop the macro processor from resolving a macro tolkein. The only thing I havent figured out is how to getthe macro qoutes off of the var name when using %nrstr. options validvarname=any; data one; "_%str(&)_"n = 123 ; put _all_ +1 ; "%str(_&_)"n = 123 ; put _all_ +1 ; %str("_&_")n = 123 ; put _all_ +1 ; %str("_&_"n) = 333 ; put _all_ +1 ; run; data two; "_%nrstr(&)_"n = 123 ; put _all_ +1 ; "%nrstr(_&_)"n = 123 ; put _all_ +1 ; %nrstr("_&_")n = 123 ; put _all_ +1 ; %nrstr("_&_"n) = 333 ; put _all_ +1 ; run;

Toby Dunn

From: Arthur Tabachneck <art297@NETSCAPE.NET> Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET> To: SAS-L Subject: Re: Bug in Proc Import and Export? Date: Sun, 25 Sep 2005 11:34:28 -0400 Howard, I can't explain why you received the error you got, but the assignment appears to work correctly using the following: options validvarname=any; data one; %str("_&_"n) = 123; x=5; put _all_ +1; run; data _null_; length name $ 8; dsid=open("","i"); do i=1 to 2; name=varname(dsid,i); put name=hex16.; end; rc=close(dsid); run; Art --------- On Sun, 25 Sep 2005 08:35:38 -0400, Howard Schreier <hs AT dc-sug DOT org> <nospam@HOWLES.COM> wrote: >Here's something, in a different context, which I don't understand. > >Say I want to create a variable named "_&_" (quotes are not part of the >name). So I run > > options validvarname=any; > > data _null_; > "_%str(&)_"n = 123; > myvarname = vname("_%str(&)_"n); > put _all_ +1 myvarname=hex10.; > run; > >In the log I see > > _ & _=123 myvarname=_ & _ _ERROR_=0 _N_=1 myvarname=5F0126025F > >The variable name has 5 characters rather than 3. The 2nd and 4th >characters aren't printable. THey appear as little squares, which may get >munged in this posting. Hence the hex dump, showing they are hex 01 and 02. > >Version 9.1.3 > >On Fri, 23 Sep 2005 23:56:42 -0400, Arthur Tabachneck <art297@NETSCAPE.NET> >wrote: > >>Earlier in the week Jerry Cotton asked what appeared to be a simple >>question. If one is trying to import and export excel spreadsheets to and >>from a directory whose name includes an ampersand (e.g., c:\r&e), how does >>one get SAS to accomplish the two tasks. >> >>A number of the list's members offered advice but, interestingly, no one >>provided an answer that worked flawlessly for Proc Import. >> >>We were able to get Proc Import to run, with the following, but while the >>file was imported correctly, the log showed: >> >>WARNING: Apparent symbolic reference E not resolved. >> >>PROC IMPORT OUT= WORK.TEST1 >> DATAFILE= "C:\%nrstr(R&E)\test1.xls" >> DBMS=EXCEL2000 REPLACE; >> GETNAMES=YES; >>RUN; >> >>The same result was attained using %str. >> >>Conversely, using single quotes, the same basic code worked, flawlessly, >>with Proc Export: >> >>PROC EXPORT DATA= WORK.TEST1 >> OUTFILE= 'C:\%nrstr(R&E)\test1A.xls' >> DBMS=EXCEL REPLACE; >>RUN; >> >>However, using %str in the above Proc Export code also created the file, >>but with the "Apparent symbolic reference E not resolved" warning. >> >>Is this a bug or am I missing something? >> >>Art

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