BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
deleted_user
Not applicable
figured it out
venkatesh
Calcite | Level 5
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;
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1043 views
  • 0 likes
  • 2 in conversation