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 Employee

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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