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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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