Date: Fri, 19 Dec 2008 10:43:42 -0600
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Rename variable names into yyyymmm_[variablename] format
In-Reply-To: <54411.150.142.232.4.1229703630.squirrel@webmail.albany.edu>
Content-Type: text/plain; charset=ISO-8859-1
That's legal, but it's not necessarily a good idea. Restricting variable
names is important if you want your code to be portable and polite (not
changing other peoples' system options), as well as your data being portable
to other systems like SPSS.
-Joe
On Fri, Dec 19, 2008 at 10:20 AM, Mike Zdeb <msz03@albany.edu> wrote:
> hi ... well, to cover all possibilities ...
>
> options validvarname=any;
>
> data test;
> input '2001'n '2002'n '2003'n;
> datalines;
> 100 200 300
> ;
> run;
>
> title "VALIDVARNAME SET TO ANY";
> proc print data=test;
> run;
>
>
> VALIDVARNAME SET TO ANY
> Obs 2001 2002 2003
> 1 100 200 300
>
>
> --
> Mike Zdeb
> U@Albany School of Public Health
> One University Place
> Rensselaer, New York 12144-3456
> P/518-402-6479 F/630-604-1475
>
> > 2008/12/19 sasbeginner <pattukuttani@gmail.com>:
> >> Hi,
> >>
> >> I need some help in coding a macro to rename all my existing varibales
> >> into something with the date + varibale name format.
> >>
> >
> >
> > Just bear in mind sas doesn't allow variables that start with a number
> > so if you want to have the year at the start try prefixing with an
> > underscore (or change the format), or as Joe has shown, make it a
> > suffix
> >
> >
>
|