|Date: ||Tue, 29 Apr 2008 08:48:35 -0700|
|Reply-To: ||"Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>|
|Subject: ||Re: character to numeric|
|Content-Type: ||text/plain; charset=iso-8859-1|
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of gayakrup@GMAIL.COM
> Sent: Tuesday, April 29, 2008 8:21 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: character to numeric
> Iam trying to write a format to use th evariable later as a
> numeric,iam not sure of wat to add.
> Proc format;
> value park
> 0='mon - 0'
> 1='tue - 1'
> 2='wed - 2'
> 3='thur - 3'
> 4='fri - 4'
> 5='Sat - 5';
> I need a statement to convert park to a numeric value to use later
> on ...put or input
> proc sort data=vis out=days (keep = visit park);
> by visit;
> where visit >= 8 ;
What you want to do is notclear to me yet. You have created a numeric format called park. You also have a variable in your dataset called park. Is that a numeric or character variable? Make sure you understand that there is no connection between the format park and the variable park unless and until the format is applied to the variable in a format statement. Understand also that when a variable is formatted, that doesn't change the underlying representation of the variable. A formatted numeric variable is still a numeric variable.
Could you provide some sample data showing what your variables are like, and then show us how you want use the variable park later that requires it to be converted in some manner. I think you will get more useful advice if you do.
Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA 98504-5204