Date: Tue, 2 Mar 1999 14:13:32 +0100
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Adolf Quast <adolf-a.quast@DB.COM>
Subject: Re: Concatenating Character Variables + Converting Date Values
Content-type: text/plain; charset=us-ascii
here are the solutions for your problems:
Note that you need the TRIM-function to get rid of trailing blanks.
/* 1. Concatenate two character-variables */
data _NULL_ ;
PRENAME = "FRED" ;
SURNAME = "LYCETT" ;
NAME = trim(PRENAME) !! " " !! trim(SURNAME) ;
put NAME= ;
Note that the solutions for DATE2 and DATE3 only show the convertion from a
into another character-variable.
Another solution would be to create a SAS-Datevalue and define a format for it
/* 2. Converting Date-Values */
data TEST ;
length DATE1-DATE3 $ 10 /* character */
DATE4 8 ; /* numeric */
DATE1 = "02281999" ; /* Original date string */
DATE2 = put(input(DATE1,mmddyy8.),ddmmyy8.) ;
DATE3 = put(input(DATE1,mmddyy8.),eurdfdd10.) ; /* New european format */
DATE4 = input(DATE1,mmddyy8.) ;
put DATE1= ;
put DATE2= ;
put DATE3= ;
put DATE4= ;
format DATE4 eurdfdd10. ;
Hope that helps,
------- Original Message --------
I have two variables -- both are of character format. They are called
FORENAME and SURNAME. I would like to derive a new variable
)let's call it NAME) which will be as follows:
NAME = FORENAME SURNAME
So if FORENAME takes the value FRED and SURNAME the value LYCETT
then the new variable NAME will need to take
the value: FRED LYCETT.
I would appreciate very much if i would receive your comments on how
to do it, please.
In addition, I have a variable that shows the date according to
american format ie. month/day/year. I would rather prefer to have
this variable according to european format ie. dd/month/year.
May I have you suggestions on how to make the conversion, please.
Thank you very much indeed for taking the time to consider my
request. I look forward to hearing from you.