Date: Sun, 9 Sep 2007 23:32:10 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Proc Transpose in EG - Creates iIlegal variables names
On Fri, 7 Sep 2007 23:02:00 -0700, David L Cassell <davidlcassell@MSN.COM>
wrote:
>excel_hari@YAHOO.COM wrote back:
>>On Sep 6, 12:28 am, nos...@HOWLES.COM ("Howard Schreier <hs AT dc-sug
>>DOT org>") wrote:
>> > On Wed, 5 Sep 2007 09:04:29 -0700, Hari <excel_h...@YAHOO.COM> wrote:
>> > >Hi,
>> >
>> > >I am doing a Proc transpose within EG.
>> >
>> > >My ID statement has values like "Microsoft Windows". In PC SAS when
>> > >one transposes a data set like this, then the new variable based on
>> > >that ID value would usually substitute illegal characters
>> > >automatically with underscores (and I want this automatic
>> > >substitution)
>> >
>> > >But in EG, the variable name remains as "Microsoft Windows" (note Im
>> > >not talking about the label). Even when I do a proc contents it is
>> > >displaying the name with a space in between.
>> >
>> > >2 clarifications: -
>> >
>> > >a) Suppose one accepts the above and wants to use the above name in
>> > >subsequent code steps of EG, then how does one refer to the above
>> > >variable (I dont want to do VALIDVARNAME=ANY)
>> >
>> > >b) I would rather want EG to behave like PC SAS and automatically
>> > >create variables with appropriate underscore characters during Proc
>> > >Transpose. Is this possible?
>> >
>> > >hp
>> >
>> > Seehttp://support.sas.com/techsup/unotes/SN/016/016867.html
>> >
>> > It deals with a different proc, but the problem and possible solutions
>> > appear to be the same.- Hide quoted text -
>> >
>> > - Show quoted text -
>>
>>Howard/Data_null),
>>
>>Thanks for the responses.
>>
>>I have added a standard option to all my EG projects VALIDVARNAME=V7,
>>so that I dont face this in future. Howard thanks a lot for the tech
>>note link.
>>
>>Data_null_ - thanks for the tip --> 'any name with blanks'n
>>
>>hp
>
>I recommend that you do it the other way around. Leave EG as is,
>but alter SAS so that your default is VALIDVARNAME=ANY .
>
>HTH,
>David
>--
>David L. Cassell
>mathematical statistician
>Design Pathways
>3115 NW Norwood Pl.
>Corvallis OR 97330
I'm going to disagree with David (that doesn't happen often). I think
VALIDVARNAME=ANY is to be avoided.
First of all VALIDVARNAME=ANY triggers a WARNING which tells you that it is
supported only for Base and Stat procedures. So it is experimental in other
contexts, apparently including the DATA step.
I suspect that having variable names which do not conform to V7 rules, and
which therefore must be represented with name literals in code, will break a
lot of existing macros. A lot of non-macro code based on generating
variables lists from metadata sources like DICTIONARY.COLUMNS will also
fail. Fixing code could get complicated, because you can't just slap the
quotation marks and the N suffix on a parameter which might already be
packaged that way; the resulting string
'''My Non-V7-Compliant Var.''n'n
will yield a variable name which looks like a name literal. Altogether, a
can of worms.
|