mercredi 21 juin 2017

SAS EG SQL create a table named "SUCCESS" if 2 counts are identical

I have two counts in my process, they should give the same result.

One is before a batch of queries, one is after, I want to make sure that the join operation haven't added or removed rows.

Right now I check these counts manually but I'd like a visual indicator that things went fine.

Thus I had the idea of writing a program that wille create an empty table named "SUCCESS" if these counts are equal, or a table named "FAILURE" if they're not.

Can you help me design the query that would achieve that ?

Here's what I have (not working obviously):

PROC SQL;
IF (SELECT count FROM WORK.count1) = (SELECT count FROM WORK.count2)
    CREATE TABLE WORK.SUCCESS
ELSE
    CREATE TABLE WORK.FAILURE
END
QUIT;

count1 and count2 are two tables that contain each a field named count, and one row with the value to be tested

Aucun commentaire:

Enregistrer un commentaire