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-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
  • 1 reply
  • 2059 views
  • 0 likes
  • 2 in conversation