Date: Sun, 13 Sep 2009 00:47:56 -0700
Reply-To: Patrick <patrick.matter@GMX.CH>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Patrick <patrick.matter@GMX.CH>
Organization: http://groups.google.com
Subject: Re: Renaming a variable which has hyphen
Content-Type: text/plain; charset=ISO-8859-1
Hi
The issue is that a dash has often a meaning withing SAS (i.e. a minus
sign) and therefore causes problems as part of a SAS variable name.
Best would be not to have such names in any SAS dataset (i.e. using
EG's import wizard for Excel you can change the variable name already
during import).
The following should work:
PROC CORR DATA=SAMPLE;
VAR ABDOMINAL 'ANTI-DEPRESSION'n;
RUN;
...or rename the variable first in the dataset:
proc datasets lib=work nodetails nolist;
modify SAMPLE;
rename 'anti-depression'n=anti_depression;
quit;
PROC CORR DATA=SAMPLE;
VAR ABDOMINAL ANTIDEPRESSION;
RUN;
HTH
Patrick