Help using Base SAS procedures

Help with merging two variable

Reply
N/A
Posts: 0

Help with merging two variable

Hi.
I am trying to create a variable called "intersection". I would like to put two variables together to form this new variable. My variables I am looking at are "ustreet1" (aka street 1) and "ustreet2" (aka the other street in the intersection, or street 2). I would like to use proc sql to create the variable. Here is the code that I thought would work:

proc sql;
create table Columbia2 as
select distinct *, ustreet1||"_"||ustreet2 as intersection
from columbia;
quit;

I have tried this numerous different ways and only get the value from "ustreet1" in the new variable "intersection". How might I go about combining these two variable into a new one. I am sure that the code I posted is almost the right way to go about it, but I think there is something wrong with the code. Any help is greatly appreciated.
Thanks
B Message was edited by: Brad151
N/A
Posts: 0

Re: Help with merging two variable

figured it out
Contributor
Posts: 61

Re: Help with merging two variable

Hi Brad...


u can go like this way also....

data columbia(drop=ustreet1 ustreet2);
input ustreet1 ustreet2;
intersection=compress(cats(ustreet1,ustreet2));
cards;
123 235
564 562
235 562
;
proc print;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 100 views
  • 0 likes
  • 2 in conversation