BookmarkSubscribeRSS Feed
Albert0
Quartz | Level 8

Hi All,

 

I'm trying to create a query in Data Preparation of SAS VIYA 8.2 and I want to distinct or make a unique records of my column. But unfortunately I can't find a tick box or built in transformation. Unlike SAS VA Data Builder it has an option on the target table to make the records unique.

 

Below are the only transformation I can find on the options.

 

Do someone knows where can I find this option on VIYA?

 

 

-Albert0

 

received_1762159403804129.jpeg

1 REPLY 1
MKQueen
SAS Super FREQ

Currently, there is not a built-in transform to create a UniqueID; however, you can achieve this by adding custom code using the Code Transform.  Here is a screen shot of an example below.

CreateUniqueID.png

 

The variable _THREADID_ returns the number that is associated with the thread that the DATA step is running in a server session.  The variable _N_ is an internal system variable that counts the iterations of the DATA step as it automatically loops through the rows of an input data set. The _N_ variable is initially set to 1 and increments by 1 each time the DATA step loops past the DATA statement. The DATA step loops past the DATA statement for every row that it encounters in the input data. Because the DATA step is a built-in loop that iterates through each row in a table, the _N_ variable can be used as a counter variable.

 

Both of these are variables that are created automatically by the SAS DATA step and saved in memory.  For more information on automatic DATA step variables refer to its help topic:

http://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=casdspgm&docsetTarget=p...

 

Hope this helps until the UniqueID Transform is added.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 2418 views
  • 0 likes
  • 2 in conversation