Date: Fri, 22 Oct 2010 08:46:19 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: RE: How to rename variable names containing invalid sas
characters ö and ä
In-Reply-To: <AANLkTi=yqHj4nw_zPgChaKk01tG_BWR1B9f5ykmW=cVs@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Tom,
Well, the positional column reference in SAS SQL
may do the trick for you:
proc sql;
create table ClassVarsRenamed as
select
1 as var1,
2 as var2,
3 as var3,
4 as var4,
5 as var5
from
sashelp.class
;
quit;
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
206-505-2367
Russell
Global Leaders in Multi-Manager Investing
From: Tom Cohen [mailto:cohen.tom78@gmail.com]
Sent: Friday, October 22, 2010 1:23 AM
To: Terjeson, Mark
Cc: SAS-L@listserv.uga.edu
Subject: Re: How to rename variable names containing invalid sas characters ö and ä
Hi Mark,
I did check if these are labels using proc contents but no they are not.
Originally the dataset was an spss file but my client has saved the data as an sas datafile and sent it to me.
When I opened the sasdatafile I got these variables with invalid characters. Is there any way to get rid of these characters?
Tom
2010/10/21 Terjeson, Mark <Mterjeson@russell.com>
Hi Tom,
Just out of curiosity, those characters are
usually no allowed as valid variable name
characters. Could you be meaning the variable
LABEL?
One way to check is to go to your dataset
explorer navigation pane in SAS and rightclick
the dataset and select View Columns. The
variable name will be the "Column Name" column
and the label will be the "Label" column.
Hope this is helpful,
Mark Terjeson
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom Cohen
Sent: Thursday, October 21, 2010 1:07 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to rename variable names containing invalid sas characters ö and ä
Dear List,
I got a sas dataset with variable names containing scandinavian characters ö
('o' with to dots) and 'ä' ('a' with two dots).
I tried to rename these variables to sas valid variables as following
data b;
set data a;
rename sätt = satt;
run;
but got an error message said sätt (containing 'a' with two dots) is
invalid sas name.
I would like to rename all variables with invalid characters automatically
something like
if any variables containing either scandinavian 'ö' or 'ä' or 'ö and ä' then
substitute these characters to 'o' and 'a'.
Thanks alot for your help.
Best regards,
Tom