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

I can use the COUNT function in Data Validation within DI Studio?

What´s the syntax?

I need to abort the job if the table has more than one record.

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

From the top of my head:

The Data Validation Node creates SAS Data Step code and the rules are applied on row level. If so then you could use the automatic variable _N_ in an expression where you abort the job if: _N_>1

View solution in original post

10 REPLIES 10
Patrick
Opal | Level 21

From the top of my head:

The Data Validation Node creates SAS Data Step code and the rules are applied on row level. If so then you could use the automatic variable _N_ in an expression where you abort the job if: _N_>1

DaveR_SAS
SAS Employee

To follow up on Patrick's suggestion, perhaps this example for a Data Validation transformation will give you an idea of how this transformation can be used:

SAS(R) Data Integration Studio 4.7: User's Guide

DavidCaliman
Calcite | Level 5

Patrick,

I need abort the job too when the table is empty.

When the table has more than one record is working!

So, the table should have only one record for the job does not fail. (_N_ <> 1 did not work!)

Tks.

LinusH
Tourmaline | Level 20

For an empty table, you could use Status Handling instead - where you can specify an action based on if the target table was updated (or not).

Data never sleeps
DavidCaliman
Calcite | Level 5

Thanks for the reply, but I want in the data validation transformation.

LinusH
Tourmaline | Level 20

Why?

Data never sleeps
Patrick
Opal | Level 21

So you need to abort the job when the table exists but has 0 records (and not "more than 1 record"). That's something else.

Can't test it but doesn't the Data Validation node include a Status Handling tab with one of the default conditions being "Table truncated". You could use this one and if truncated then select action "abort all processes".

SAS(R) Data Integration Studio 4.21: User's Guide

P.S: You should always post the DIS version so we can know what's available to you "out-of-the-box".

Quentin
Super User

Or just add the check as a user-written code module?

Is this seen as "bad form" in DI Studio land?  I haven't done much with DI studio besides user-written code, so I'm curious if people often mix DI transformation nodes with user-written nodes.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Patrick
Opal | Level 21

Best practice is to use user written code only if you can't do it with an existing transformation.

Quentin
Super User

THanks Patrick.  Rather than hijack this thread, I'll start another one relating to pros and cons of mixing the canned transformations with user written code.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 10 replies
  • 3988 views
  • 3 likes
  • 5 in conversation