Concatentating two variables

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Concatentating two variables

The Burl
Thanks in advance for any advice on this!

The data:
Hospital Id, which is numerical ranging from 1-4 digits (e.g. #3 to #3213)
Combine with a variable that identifies a respondent's work group (e.g., "pharmacy") which I have as a string variable, as well as a numeric (e.g., "a" and "1")

It seems fairly simple to concatentate these two variables but I'm having difficulties... Would RTRIM help here?

A sample of the data is attached...

Thank you!Data_Sample.sav
Reply | Threaded
Open this post in threaded view
|

Re: Concatentating two variables

Art Kendall
GET
  FILE='C:\Users\Art\AppData\Local\Temp\Data_Sample.sav'.
string bigID1 (a6) bigID2(a5).
compute bigID1 = concat(string(Hospital,N4),String(Unit_numerical,n2)).
compute bigID2 = concat(string(Hospital,N4),Unit_string).
list.

Art Kendall
Social Research Consultants
On 8/26/2013 5:37 PM, The Burl [via SPSSX Discussion] wrote:
Thanks in advance for any advice on this!

The data:
Hospital Id, which is numerical ranging from 1-4 digits (e.g. #3 to #3213)
Combine with a variable that identifies a respondent's work group (e.g., "pharmacy") which I have as a string variable, as well as a numeric (e.g., "a" and "1")

It seems fairly simple to concatentate these two variables but I'm having difficulties... Would RTRIM help here?

A sample of the data is attached...

Thank you!Data_Sample.sav


If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Concatentating-two-variables-tp5721736.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Concatentating two variables

The Burl
Thanks Art, worked like a charm. This listserv is such a great resource... -Jon