You can use the string() function inside the concat() to convert the
value of Year to a string for the purposes of the transformation. You
may also want to use rtrim() on the V1 variable to remove trailing
blanks as necessary, e.g.,
string newvar (a8).
compute newvar = concat(rtrim(V1),string(Year,N4)).
Parise, Carol A. wrote:
> Hi all,
>
> I need to compute a new variable that combines a string variable with a
> year variable which is stored as a number.
>
> For example:
> V1 Year
> A5 2007
> C90 2006
>
> I would like my new variable to be a string:
>
> A52007
> C902006
>
> Should i just convert my year to a string and use concat to do this or
> does someone know of a trick so that i can leave year as a number?
>
> Thanks
> Carol
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
>
LISTSERV@... (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
--
Daniel Robertson
Senior Research and Planning Associate
Institutional Research and Planning
Cornell University / irp.cornell.edu
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD