sas >> Converting character to numeric on datasets in EnterpriseGuide

by mwalker » Mon, 01 Dec 2008 16:57:48 GMT

Hi I have been playing around in SAS Enterprise Guide 4.1 and can't seem
to find a method to convert a dataset that I have pulled into the project -
then filtered/queried further and now I need to convert a character
column, to an numeric, yet can't seem to find a method to do this does
anyone know of one ?

Thanks
Michael Walker


sas >> Converting character to numeric on datasets in EnterpriseGuide

by Haris » Tue, 02 Dec 2008 00:09:19 GMT


The IMPORT dialog box provides the capability to switch formats from
character to numeric via pull-down menu choices and without
programming.

Be careful--I've had multiple experiences with Microsft data sources
where character to numeric translation changes the data. Use raw data
files if you have to deal with MS.



Similar Threads

1. Convert to numeric where Date field Numeric and Character

I have a  date field can be numeric and populated or
character and blank (only these 2 scenarios)
if it's populated it has this format MMDDYY10.  numeric and if it's
character then it's just blank.


so what i need is for the numeric date to look like this: Numeric,
Length 8, Format 11.  and look like 20100214      and if it's
character then convert it so it looks like 20100214.

Thank you

2. a good practice to convert character to numeric

3. One liner to convert numeric ssn to 9-digit character variable with leading zeros

I need to create a flat file which contains a 9 digit social security
number with the leading zeros.  My SAS dataset contains an ssn as a
numeric variable.  The SAS ssn format contains the dashes so that does
not work in a put or input statement.  Does anyone know of a put
statement with a format that would work in the data _null_ step that
creates the flat file?  Or, does someone know of some other one-liner
that would create the 9-digit ssn with leading zeros as another
variable that could then be put to the flat file?  Thanks.

4. One liner to convert numeric ssn to 9-digit character

5. Convert from Character to Numeric

Trying to Convert from Character to Numeric. Can anyone please let me know
 what may be possible wrong with the following coding:

    format birthdtn DATE9.;
    birthdtn=input(compress(birthdt, '-'), date9.);


Getting following error:
NOTE: Invalid argument to function INPUT at line 2308 column 14.
SUBJID=0020033 SEX=Female BIRTHDT=19610424 birthdtn=. _ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 2308 column 14.
SUBJID=0020033 SEX=Female BIRTHDT=19610424 birthdtn=. _ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 2308 column 14.

Thank you.

6. A NEED FOR CONVERTING FROM CHARACTER TO NUMERIC

7. converting numeric values to character

I'm having problems converting my variable 'laystage', which is numeric
(BEST12.), into a character variable. I created a new variable 'wave'
for this, using "wave = laystage". However, the results are very
confusing. Wave is still a numeric variable. The PUT statement seems to
be doing the exact opposite - converting character values to numeric.
Can anyone tell me what is going wrong? FYI, the values of laystage
range from -7 to 7, in integers or numbers ending in .5.

Here are the results from my Log window:

109  data mylib.loggers030405append4finalwoATFL;
110  set mylib.loggers030405append4finalwoATFL;
111  wave = PUT (laystage, BEST12.);

NOTE: Character values have been converted to numeric values at the
places given by:
      (Line):(Column).
      111:8
NOTE: There were 1427 observations read from the data set
      MYLIB.LOGGERS030405APPEND4FINALWOATFL.
NOTE: The data set MYLIB.LOGGERS030405APPEND4FINALWOATFL has 1427
observations and 74
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.13 seconds
      cpu time            0.04 seconds

And here's what PROC CONTENTS displays after the conversion:
   #  Variable              Type  Len  Format       Informat     Label
  31  laystage             Num     8
laystage
  74  wave                  Num     8
 laystage in text format

8. How to convert character format to numeric format?