BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Prateek1
Obsidian | Level 7

hi,

i just want to know that  how to create a Unique ID in the data set using two variables in the data set using TRIM and double pipe function ?

please give me the code ?

thanks 

sas_learner

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Find a character which doesn't occur in your vaiables, such as "@", and create your unique ID as

 

length uniqueID $20; /* To be adjusted */

uniqueID = catx("@", var1, var2);

PG

View solution in original post

4 REPLIES 4
Reeza
Super User

I'm confused, it sounds like you know what you want, are you having issues creating the variable?
If so, post the code you've used and are having issues with. I'm also uncertain as to what you mean by double pipe function. 

 

There is a double pipe that is used to represent concatenation, but in my opinion, the CAT family of functions are better, especially since they'll do things like trim by default (CATT).

PGStats
Opal | Level 21

Find a character which doesn't occur in your vaiables, such as "@", and create your unique ID as

 

length uniqueID $20; /* To be adjusted */

uniqueID = catx("@", var1, var2);

PG
Prateek1
Obsidian | Level 7

hi,

using  when-select statements, how can we define a new variable providing the country of each model based on the manufacturer.??

thanks ,

 

Reeza
Super User

@Prateek1 Please post your question as a new topic. 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 4706 views
  • 1 like
  • 3 in conversation