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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5061 views
  • 1 like
  • 3 in conversation