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

I have an input table that includes a variable called "insured_sk". It contains a few duplicate values. How do I use a Extract transformation to ensure that only distinct insured_sk values are extracted? I figure there should be an expression I can use.

I realize that this is the kind of question that I'll be hitting myself in the head about once i hear the answer, as it's probably very, very simple.

Thanks for your attention. Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

Here's a punch:

there is a Distinct option in the extract transform.

Since this is SQL, it will keep distinct records, not distinct columns, so be sure to drop any columns that will prevent you from having distinct values.

Data never sleeps

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20

Here's a punch:

there is a Distinct option in the extract transform.

Since this is SQL, it will keep distinct records, not distinct columns, so be sure to drop any columns that will prevent you from having distinct values.

Data never sleeps
sprogger
Calcite | Level 5

I am trying to do the same thing. The answer provided does not really address the issue. I want ALL the columns in a row; but wish to purely do a distinct(col1). Of course you could do a join on the table containing only the distinct column with the original table but even then you would get multiple rows with multiple records from this table. It is weird that an option does not exist to select a column(s) for the distinct keyword other than writing code.

LinusH
Tourmaline | Level 20

Again, this due to the limitations of SQL.

Sounds like you want to do a NODUPKEY. For that, use the Sort transformation.

Data never sleeps

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 5439 views
  • 0 likes
  • 3 in conversation